题干:
There is a number N.You should output "YES" if N is a multiple of 2, 3 or 5,otherwise output "NO".
Input
There are multiple test cases, no more than 1000 cases.
For each case,the line contains a integer N.(0<N<1030)(0<N<1030)
Output
For each test case,output the answer in a line.
Sample Input
2
3
5
7
Sample Output
YES
YES
YES
NO
解题报告:
水题啊。判断是否是2,3,5的倍数。
AC代码:
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#define ll long long
using namespace std;
char s[100005];
int main()
{
while(~scanf("%s",s+1)) {
int len = strlen(s+1);
ll sum = 0;
for(int i = 1; i<=len; i++) {
sum += s[i] - '0';
}
if(sum%3==0 || (s[len] - '0') %2 == 0 || (s[len] - '0' == 5)) puts("YES");
else puts("NO");
}
return 0 ;
}