/***
Md. Namzul Hasan
Shahjalal University of Science & Technology,Sylhet.
hasan08sust@gmail.com
***/
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
typedef int in ;
typedef unsigned long long ull ;
const double pi = 2*acos(0) ;
#define maxi 40000
#define pf printf
#define sc scanf
#define pb push_back
#define MEM(x,y) (memset((x),(y),sizeof(x)))
#define MIN(x,y) ((x) < (y) ? (x) : (y))
#define MAX(x,y) ((x) > (y) ? (x) : (y))
#define load(array,size) for(int i=0 ; i<size ; i++) cin>>array[i] ;
#define new_line pf("\n")
#define clear_data(array) memset(array,0,sizeof(array))
#define highest_int 2147483647
int main()
{
int test ;
ll cnt =1 ;
ll s ;
while(sc("%lld",&s)==1 && s)
{
ll n = ceil(sqrt(s)) ;
ll m = n*n ;
ll x ,y ;
if(m&1)
{
ll k = m -n +1 ;
if(k==s)
x=y=n ;
else if(s>k){
x = n ;
y = m -s +1 ;
}
else if(s<k){
y =n ;
ll a = m - (2*n)+2 ;
x = s- a +1 ;
}
cout<<y<<" "<<x<<endl ; }
else
{
ll k = m -n +1 ;
if(k==s)
x=y=n ;
else if(s<k){
x =n ;
ll a = m - (2*n)+ 2 ;
y = s-a+1 ;
}
else if(s>k){
y =n ;
x =m-s+1 ;
}
cout<<y<<" "<<x<<endl ;
}
}
return 0;
}
Md. Namzul Hasan
Shahjalal University of Science & Technology,Sylhet.
hasan08sust@gmail.com
***/
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
typedef int in ;
typedef unsigned long long ull ;
const double pi = 2*acos(0) ;
#define maxi 40000
#define pf printf
#define sc scanf
#define pb push_back
#define MEM(x,y) (memset((x),(y),sizeof(x)))
#define MIN(x,y) ((x) < (y) ? (x) : (y))
#define MAX(x,y) ((x) > (y) ? (x) : (y))
#define load(array,size) for(int i=0 ; i<size ; i++) cin>>array[i] ;
#define new_line pf("\n")
#define clear_data(array) memset(array,0,sizeof(array))
#define highest_int 2147483647
int main()
{
int test ;
ll cnt =1 ;
ll s ;
while(sc("%lld",&s)==1 && s)
{
ll n = ceil(sqrt(s)) ;
ll m = n*n ;
ll x ,y ;
if(m&1)
{
ll k = m -n +1 ;
if(k==s)
x=y=n ;
else if(s>k){
x = n ;
y = m -s +1 ;
}
else if(s<k){
y =n ;
ll a = m - (2*n)+2 ;
x = s- a +1 ;
}
cout<<y<<" "<<x<<endl ; }
else
{
ll k = m -n +1 ;
if(k==s)
x=y=n ;
else if(s<k){
x =n ;
ll a = m - (2*n)+ 2 ;
y = s-a+1 ;
}
else if(s>k){
y =n ;
x =m-s+1 ;
}
cout<<y<<" "<<x<<endl ;
}
}
return 0;
}
No comments:
Post a Comment