1、找規律題,容易出錯,多弄些測試資料。
#include <stdio.h>
int main(void)
{
int count,n,minus;
while(scanf("%d",&n)==1)
{
if(n==0) break;
count=1;
while(count*count<n)
count++;
minus=count*count-n;
if(count%2==1)
{
if(minus<count)
printf("%d %d\n",minus+1,count);
else
printf("%d %d\n",count,count*count-(count-1)*(count-1)-minus);
}
else
{
if(minus>=count)
printf("%d %d\n",count*count-(count-1)*(count-1)-minus,count);
else
printf("%d %d\n",count,minus+1);
}
}
return 0;
}