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 |
为啥都过了还是WA啊??!!哭死了 ```贡献了N次#include<iostream> #include<cmath> using namespace std; int main() { int a,b,n; int i,j,k; double sum,zem; while(cin>>a>>b>>n) { if(a==0&&b==0&&n==0) break; k=0; sum=a; zem=0; for(i=1;;i++) { for(j=2;j<=sqrt(sum);j++) { if(int(sum)%j==0) break; } if(j>sqrt(sum)) { k++; zem=sum; } sum=sum+b; if(k==n) { break; } } if(zem==1) { cout<<'2'<<endl; } else { cout<<zem<<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