| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
庆祝第62题!!开始以为很难,一个晚上没有什么灵感,第二天醒来灵感爆发,发现也就如此。。。。一遍AC/*
Author: sgxiao
Title: 1969 -- Count on Canton
LANG: C
Date : Sun Sep 7 07:24:30 CST 2008
*/
#include<stdio.h>
int main(void)
{
int k;
int n;
int n_1;
while (1) {
if (scanf("%d", &n) == EOF) break;
n_1 = n;
k = 0;
while(n > 0) {
k++;
n -= k;
}
if(k % 2 == 0) {
printf("TERM %d IS %d/%d\n", n_1, k + n, 1 - n);
} else if (k % 2 == 1) {
printf("TERM %d IS %d/%d\n", n_1, 1 - n, k + n);
}
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator