2 solutions
-
0
#include<iostream>//判断数字能否被137或者73整除 #include<cstring> using namespace std; const int A[2]={73,137}; const int N=1e9; int len,con=0,p=0; char a[N]; int main() { while(cin>>a) { p++; len=strlen(a); for(int i=0;i<2;i++) { con=0; for(int j=0;j<len;j++) { con=((con*10)+a[j]-'0')%A[i]; } if(con==0) { break; } } if(con==0) { cout<<"Case #"<<p<<": YES"<<endl; } else { cout<<"Case #"<<p<<": NO"<<endl; } } return 0; }
Information
- ID
- 285
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 7
- Tags
- # Submissions
- 129
- Accepted
- 33
- Uploaded By