Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

庆祝第62题!!开始以为很难,一个晚上没有什么灵感,第二天醒来灵感爆发,发现也就如此。。。。一遍AC

Posted by sgxiao at 2008-09-07 08:08:59 on Problem 1969 and last updated at 2008-09-07 08:09:14
/*
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator