解题思路:
注意事项:
参考代码:
#include <stdio.h>
int main(){
int a,b;
int n;
int i;
int count;
while(~scanf("%d", &n)){
i = 1;
count = 0;
while(count >= 0){
if(i%2 == 0){
b = i+1;
for(int j = i; j >= 1; j--){
count++;
if(count == n){
a = j;
count = -1;
break;
}
}
b -= a;
}
else{
b = i+1;
for(int j = 1; j <= i; j++){
count++;
if(count == n){
a = j;
count = -1;
break;
}
}
b -= a;
}
i++;
}
printf("%d/%d\n", b,a);
}
return 0;
}
0.0分
0 人评分