📄 1649.cpp
字号:
/* This Code is Submitted by wywcgs for Problem 1649 on 2005-03-27 at 16:34:35 */
#include <stdio.h>
#include <math.h>
int main()
{
long term, n, a;
while(scanf("%ld", &term) == 1){
n = (1 + (long)sqrt(1+8*term)) / 2;
while(n * n - n < 2 * term){
n++;
}
n--;
a = term - (n * n - n) / 2;
if(n % 2 == 0){
printf("TERM %ld IS %ld/%ld\n", term, a, (n+1-a));
}else{
printf("TERM %ld IS %ld/%ld\n", term, (n+1-a), a);
}
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -