HDU 5585(数论)
来源:互联网 发布:安装软件出现2503 编辑:程序博客网 时间:2024/05/16 19:41
Numbers
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<1030)
For each case,the line contains a integer N.
Output
For each test case,output the answer in a line.
Sample Input
2357
Sample Output
YESYESYESNO
Source
BestCoder Round #64 (div.2)
#include <iostream>#include <cstdio>#include <cstring>#include <cstdlib>#include <vector>#include <map>#include <list>#include <cmath>#include <queue>#include <stack>#include <set>#include <algorithm>#define LL long long#define INF 0x3f3f3f3f#define RR freopen("in.txt","r",stdin)#define WW freopen("out.txt","w",stdout)#define lson l,m,rt<<1#define rson m+1,r,rt<<1|1using namespace std;int main(){ char s[1010]; while(cin>>s) { int sum = 0; int len = strlen(s); for(int i=0; i<len; i++) sum += (s[i] - '0'); if(sum % 3 == 0 || (s[len-1] - '0')%2==0 || s[len-1] - '0'==5) cout<<"YES"<<endl; else cout<<"NO"<<endl; } return 0;}
0 0
- HDU 5585(数论)
- HDU 2204 (数论)
- 数论 MillerRabin hdu 3792
- HDU 3123 数论
- 【数论】HDU-4196-Remoteland
- HDU 3988 数论
- HDU 1787 数论
- hdu 1395 数论
- HDU 2104数论 欧几里得
- HDU 1060 数论
- HDU 2161 Primes 数论
- HDU 1695 GCD 数论
- HDU 1568 Fibonacci 数论
- hdu 4542 数论
- hdu 1722(数论)
- hdu 1492(数论)
- hdu 2554 (数论)
- hdu 2964 (数论)
- 软件设计度量工具structure101学习(六):Project Properties
- UIPickerView基本用法
- QT实现Webdav的HTTPS通信
- Android-Android系统源码下载2
- String,StringBuffer与StringBuilder的区别
- HDU 5585(数论)
- Android Manifest标签之action, activity-alias, category和compatible-screens
- DedeCMS 去掉文章及分类.html后缀的方法
- Android Studio 简单设置
- 文章标题
- java内存管理机制
- 《ArcGIS Runtime SDK for Android开发笔记》——(10)、ArcGIS Runtime SDK支持的空间数据类型
- IOS 截屏模糊 的问题
- IPv4网络地址与子网划分