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
  1. 2
  2. 3
  3. 5
  4. 7
Sample Output
  1. YES
  2. YES
  3. YES
  4. NO
  5.  
  6. 这个没必要再说了吧,,
  1. #include<stdio.h>
  2. //#include<bits/stdc++.h>
  3. #include<string.h>
  4. #include<iostream>
  5. #include<math.h>
  6. #include<sstream>
  7. #include<set>
  8. #include<queue>
  9. #include<vector>
  10. #include<algorithm>
  11. #include<limits.h>
  12. #define inf 0x3fffffff
  13. #define lson l,m,rt<<1
  14. #define rson m+1,r,rt<<1|1
  15. #define LL long long
  16. using namespace std;
  17. int main()
  18. {
  19. char s[100000];
  20. int i;
  21. __int64 sum;
  22. int ans;
  23. int len;
  24. while(cin>>s)
  25. {
  26. sum=0;
  27. len=strlen(s);
  28. for(i=0;i<len;i++)
  29. {
  30. sum+=(s[i]-'0');
  31. }
  32. ans=s[len-1]-'0';
  33. if(ans%2==0||s[len-1]=='5'||sum%3==0)
  34. {
  35. cout<<"YES"<<endl;
  36. }
  37. else
  38. {
  39. cout<<"NO"<<endl;
  40. }
  41. }
  42. return 0;
  43. }

  

BestCoder Round #64 1001的更多相关文章

  1. 贪心 BestCoder Round #39 1001 Delete

    题目传送门 /* 贪心水题:找出出现次数>1的次数和res,如果要减去的比res小,那么总的不同的数字tot不会少: 否则再在tot里减去多余的即为答案 用set容器也可以做,思路一样 */ # ...

  2. (BestCoder Round #64 (div.2))Array

    BestCoder Round #64 (div.2) Array 问题描述 Vicky是个热爱数学的魔法师,拥有复制创造的能力. 一开始他拥有一个数列{1}.每过一天,他将他当天的数列复制一遍,放在 ...

  3. 暴力 BestCoder Round #41 1001 ZCC loves straight flush

    题目传送门 /* m数组记录出现的花色和数值,按照数值每5个搜索,看看有几个已满足,剩下 5 - cnt需要替换 ╰· */ #include <cstdio> #include < ...

  4. 暴力 BestCoder Round #46 1001 YJC tricks time

    题目传送门 /* 暴力:模拟枚举每一个时间的度数 详细解释:http://blog.csdn.net/enjoying_science/article/details/46759085 期末考结束第一 ...

  5. 字符串处理 BestCoder Round #43 1001 pog loves szh I

    题目传送门 /* 字符串处理:是一道水题,但是WA了3次,要注意是没有加'\0'的字符串不要用%s输出,否则在多组测试时输出多余的字符 */ #include <cstdio> #incl ...

  6. BestCoder Round #75 1001 - King's Cake

    Problem Description It is the king's birthday before the military parade . The ministers prepared a ...

  7. ACM学习历程—HDU5585 Numbers(数论 || 大数)(BestCoder Round #64 (div.2) 1001)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5585 题目大意就是求大数是否能被2,3,5整除. 我直接上了Java大数,不过可以对末尾来判断2和5, ...

  8. BestCoder Round #92 1001 Skip the Class —— 字典树 or map容器

    题目链接:http://bestcoder.hdu.edu.cn/contests/contest_showproblem.php?cid=748&pid=1001 题解: 1.trie树 关 ...

  9. BestCoder Round #61 1001 Numbers

    Problem Description There are n numbers A1,A2....An{A}_{1},{A}_{2}....{A}_{n}A​1​​,A​2​​....A​n​​,yo ...

随机推荐

  1. Linux-CentOS 学习的坎坷路 (一) 网络配置篇

    自己学习的地址:http://www.imooc.com/view/175 学到2.8章节,配置IP这一块,妈蛋,他直接跳过了,都不知道怎么配置,无奈,只能Search 先是找到配置IP的方法: ht ...

  2. ActionBarActivity的使用注意事项

    1.调用getActionbar()方法返回为空的解决方法 此activity是设计来支持低版本系统用actionbar的,低版本没有getActionbar() 需要使用 getSupportAct ...

  3. curl的特殊使用

    1.php可以通过shell_exec()和其他系统函数使用curl,也可用PHP带的libcurl库. $curl = curl_init("wwww.baidu.com"); ...

  4. 2018网络预选赛 徐州G 线段树

    线段树,假设求(x1,y1)点的贡献,就找所有比该点出现时间晚,且x坐标大于x1的点中y最大的,贡献就是Y-y1,由于题目条件限制,不可能有x坐标大于(x1,y1)且y坐标大于y1的点,所以贡献肯定为 ...

  5. alias这个命令还是很有用的

    这是在知乎看到的一个回答. 我一开始学习linux命令的时候觉得这个alias命令很奇怪,为什么要给别人起个别名呢?有什么好处? 因为当时接触的是比较简单的命令 比如ls -al的这种短小的命令,对a ...

  6. 高性能MySQL笔记-第5章Indexing for High Performance-002Hash indexes

    一. 1.什么是hash index A hash index is built on a hash table and is useful only for exact lookups that u ...

  7. 每个程序中只有一个public类,主类?

    import java.io.*; public class GameSaverTest { public static void main(String[] args){ //创建人物 GameCh ...

  8. ZROI2018提高day5t1

    传送门 分析 我们不难将条件转换为前缀和的形式,即 pre[i]>=pre[i-1]*2,pre[i]>0,pre[k]=n. 所以我们用dp[i][j]表示考虑到第i个数且pre[i]= ...

  9. ListBox 光标如何定位在最后一行 显示

    richTextBox_show.SelectionStart = richTextBox_show.Text.Length - 1; richTextBox_show.Focus();

  10. win10和ubuntu双系统下卸载ubuntu

    1.进入win10 2.下载EasyBCD,360软件管家里面有,version=2.2 3.启动软件,工具箱里面选择“BCD部署”→MBR配置选项中选“在MBR中安装Windows Vista/7的 ...