Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- int main()
- {
- long x;
- while(1){
- scanf("%ld",&x);
- if(x==0)
- break;
- int sqr=ceil(sqrt(x));
- long i,j;
- if(sqr%2==0){
- long temp=sqr*sqr-sqr+1;
- i=sqr;
- j=sqr;
- while(temp<x){
- j--;
- temp++;
- }
- while(temp>x){
- i--;
- temp--;
- }
- }
- else{
- long temp=sqr*sqr-sqr+1;
- i=sqr;
- j=sqr;
- while(temp<x){
- i--;
- temp++;
- }
- while(temp>x){
- j--;
- temp--;
- }
- }
- printf("%ld %ld\n",i,j);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement