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

求帮忙看下哪里错了。。一直超时

Posted by lafengxiaoyu at 2016-09-17 20:39:09 on Problem 1012
#include <iostream>
#include <string>

using namespace std;


int main()
{
	int k;
	cin >> k;
	int kk=k;
	if (kk == 0)
		goto sss2;
	while (kk!=0)
	{

		int cycle = k + 1;


		while (1)
		{
			int cishu = 0;//表示循环次数
			int point = 0;


			while (1)
			{
				point = point + cycle-1;
				int youxiao= 2 * k - cishu;
				//while (point >= (2 * k - cishu))//2 * k - cishu是当前数组内的有效数数量
				//{
				//	point = point - (2 * k - cishu);
				//}
				point = point % (youxiao);//代码运行效率提高一个n的复杂度

				if (point < k)
				{
					goto sss;
				}

				cishu++;
				if (cishu == k)
				{
					goto sss1;
				}

			}

		sss:
			;

			cycle++;

		}

	sss1:
		;


		cout << cycle << endl;
		cin >> k;
		int kk = k;
		if (kk == 0)
			break;
	}
sss2:
	;
	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