不要让昨天 占据你的今天 夏午晴天

夏午晴天

判断是否被2,3,5整除

/*

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
*/

#include <iostream>
#include <string.h>
using namespace std;
int main() {
    char n[1000000];
    while(cin>>n)
    {
        long long i, sum;
        sum = 0;
        for(i=0; i< strlen(n); i++)
            sum = sum + n[i]- '0';
        long long t = n[i-1]- '0';
        if (t%5==0 || t%2==0 || sum%3==0)
            cout<<"YES"<<endl;
        else
            cout<<"NO"<<endl;
    }
    return 0;
}

posted on 2017-02-21 16:05  夏晴天  阅读(187)  评论(0编辑  收藏  举报

导航

Live2D