Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<math.h>
- int main()
- {
- long long int t,i,n,x,y,sq,tmp;
- freopen("input.txt","r",stdin);
- scanf("%lld",&t);
- for(i=1;i<=t;i++){
- scanf("%lld",&n);
- sq=ceil(sqrt((double)(n)));
- if(sq*sq-n<sq){
- x=sq;
- y=sq*sq-n+1;
- }
- else{
- x=-sq*sq+2*sq+n-1;
- y=sq;
- }
- if(sq&1){
- tmp=x;
- x=y;
- y=tmp;
- }
- printf("Case %lld: %lld %lld\n",i,x,y);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement