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> using namespace std; int main() { unsigned long a; while(cin>>a) { unsigned long b,c,sum=10000000000000000000; for(b=a+1;b<=a*a+a+1;b++) { if((a*b+1)%(b-a)==0) { c=(a*b+1)/(b-a); if(sum>(b+c)) sum=b+c; } } cout<<sum<<endl; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator