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

还是很水的嘛!21行0Ms AC了,哇咔咔咔哈哈哈~~~

Posted by w598113636 at 2012-01-20 16:04:29 on Problem 1969
//找找规律嘛!把每个斜行单独放一堆,规律就出来了~
#include<stdio.h>
int main()
{
	int n,i,k=0,sum;
	while(~scanf("%d",&n))
	{
		sum=0;
		for(i=1;;i++)
		{
			sum+=i;
			if(sum>=n)
				break;
		}
		sum-=i;
		if(i%2==0)
			printf("TERM %d IS %d/%d\n",n,n-sum,sum+i+1-n);
		else
			printf("TERM %d IS %d/%d\n",n,i+sum-n+1,n-sum);
	}
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