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

      

  • 相关阅读:
    LaTeX插入数学公式
    清除浮动的4种方式
    水平居中与垂直居中
    如何实现两三栏布局
    BFC
    flex弹性盒子
    盒模型
    Git
    jQuery设置disabled属性与移除disabled属性
    TP---where多条件查询
  • 原文地址:https://www.cnblogs.com/yinghualuowu/p/5004727.html
Copyright © 2011-2022 走看看