| ||||||||||
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 |
求帮忙看下哪里错了。。一直超时#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator