UVA 10161
#include<iostream> using namespace std; int main() { int m; while(cin>>m) { if(m==0)break; if(m==1)cout<<"1 1"<<endl; else { int i,x=1,y=1; for(i=1;;i++) { if(m>=(i*i+1)&&m<=((i+1)*(i+1))) { if(i%2==1) { if(m<=(i*(i+1))) { y=i+1; x=m-i*i; } else { x=i+1; y=(i+1)*(i+1)-m+1; } } else { if(m<=(i*(i+1))) { x=i+1; y=m-i*i; } else { y=i+1; x=(i+1)*(i+1)-m+1; } } break; } } cout<<x<<" "<<y<<endl; } } return 0; }