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

等差项数数列分组后模拟 0MS 过 附代码

Posted by long1897 at 2014-07-24 02:13:15 on Problem 1969
#include<iostream>
using namespace std;
int main()
{
	int n,t,count1,count2;
	while( scanf("%d",&t) != EOF )
	{
		n = 1;
		count1 = count2 = 0;
		while( count1 != t )
		{
			count1++;
			count2++;
			if( count2 == n )
			{
				if( count1 != t )
				{
					count2 = 0;
					n++;
				}
			}
		}
		if( n % 2 == 0 )
			cout<<"TERM "<<t<<" IS "<<count2<<"/"<<n-count2+1<<endl;
		else
			cout<<"TERM "<<t<<" IS "<<n-count2+1<<"/"<<count2<<endl;
	}
	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