BestCoder Round #64 1001
2015-11-29 14:19
525 查看
Numbers
Accepts: 480Submissions: 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; }
相关文章推荐
- iOS UIKit:Auto Layout
- 内存工作原理
- 15、OSPF配置实验之LSA4、LSA5
- iOS开发——网络请求案例汇总(AFNetworking)
- LintCode-剑指Offer-(378)将二叉查找树转换成双链表
- RegAsm注册DLL组件使用jacob调用的问题com.jacob.com.ComFailException: Can't co-create object
- iOS textView的使用总结
- Webkit之HTMLTokenizer分析
- 性能测试涉及的人员
- SVM(Support Vector Machine)读书笔记二(支持向量和Kernel方法)
- DOM----nodeType,nodeName,nodeValue笔记
- jQuery动画animate和scrollTop结合使用
- iOS开发之页面跳转
- 代码小技巧1
- WebKit之UserAgent分析
- Webkit之HTMLToken处理
- Java日志学习四:Simple Logging Facade for Java (SLF4J)源码浅析
- [LeetCode]Binary Tree Level Order Traversal
- ZuoyeOc-03
- 揭秘Magic Leap技术背景:混合现实前景如何