?? 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 + -