#include <iostream>
#include <cmath>
using namespace std;
int n,st,en;
int main(){
ios::sync_with_stdio(0);
int n;
while(cin>>n){
if(!n)
return 0;
int sq=sqrt(n);
/*if(sq*sq<n)
sq++;
else*/
if(sq*sq==n){
if(n&1)
cout<<1<<' '<<sq<<endl;
else
cout<<sq<<' '<<1<<endl;
continue;
}
// cout<<sq<<" ";
if((sq&1)){
if(n-sq*sq<=sq)
cout<<n-sq*sq<<' '<<sq+1<<endl;
else
cout<<sq+1<<' '<<sq+1-(n-sq*sq-sq-1)<<endl;
}
else{
if(n-sq*sq<=sq)
cout<<sq+1<<' '<<n-sq*sq<<endl;
else
cout<<sq+1-(n-sq*sq-sq-1)<<' '<<sq+1<<endl;
}
}
}
#include <cmath>
using namespace std;
int n,st,en;
int main(){
ios::sync_with_stdio(0);
int n;
while(cin>>n){
if(!n)
return 0;
int sq=sqrt(n);
/*if(sq*sq<n)
sq++;
else*/
if(sq*sq==n){
if(n&1)
cout<<1<<' '<<sq<<endl;
else
cout<<sq<<' '<<1<<endl;
continue;
}
// cout<<sq<<" ";
if((sq&1)){
if(n-sq*sq<=sq)
cout<<n-sq*sq<<' '<<sq+1<<endl;
else
cout<<sq+1<<' '<<sq+1-(n-sq*sq-sq-1)<<endl;
}
else{
if(n-sq*sq<=sq)
cout<<sq+1<<' '<<n-sq*sq<<endl;
else
cout<<sq+1-(n-sq*sq-sq-1)<<' '<<sq+1<<endl;
}
}
}
Comments
Post a Comment