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 |
求助(Time Limit Exceed)#include<iostream.h> #include<math.h> void main() { long a,i,j,p=0,b; while(1) { cin>>a; if(a==0) break; else { b=int(sqrt(a)); //cout<<b; for(i=2;i<a;i++) for(j=2;j<=b;j++) { if(a%j==0&&i%j==0) { //cout<<i<<' '<<j<<endl; p++; break; } } cout<<a-p-1<<endl; p=0; } } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator