zoukankan      html  css  js  c++  java
  • BestCoder Round #64 1001

    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<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<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;
    }
    

      

  • 相关阅读:
    索引初识
    python数据类型之 元祖、列表字典
    linux常用命令之网络命令
    linux命令之查找find &grep
    python数据类型之可hash,不可hash
    python面向对象之封装,多态与继承
    python之新式类与经典类
    python之random随机函数
    CSS3选择器(一)
    关于居中
  • 原文地址:https://www.cnblogs.com/yinghualuowu/p/5004727.html
Copyright © 2011-2022 走看看