您的位置:首页 > 其它

BestCoder Round #64 1001

2015-11-29 14:19 525 查看

Numbers

Accepts: 480

Submissions: 1518

Time Limit: 2000/1000 MS (Java/Others)

Memory Limit: 65536/65536 K (Java/Others)

Problem Description

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<{10}^{30})(0<N<10​30​​)

Output

For each test case,output the answer in a line.

Sample Input

2
3
5
7


Sample Output

YES
YES
YES
NO

这个没必要再说了吧,,


#include<stdio.h>
//#include<bits/stdc++.h>
#include<string.h>
#include<iostream>
#include<math.h>
#include<sstream>
#include<set>
#include<queue>
#include<vector>
#include<algorithm>
#include<limits.h>
#define inf 0x3fffffff
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
using namespace std;
int main()
{
char s[100000];
int i;
__int64 sum;
int ans;
int len;
while(cin>>s)
{
sum=0;
len=strlen(s);
for(i=0;i<len;i++)
{
sum+=(s[i]-'0');
}
ans=s[len-1]-'0';
if(ans%2==0||s[len-1]=='5'||sum%3==0)
{
cout<<"YES"<<endl;
}
else
{
cout<<"NO"<<endl;
}
}
return 0;
}


  
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: