hdoj 1014 Uniform Generator
来源:互联网 发布:学算法入门看什么书 编辑:程序博客网 时间:2024/06/05 03:10
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1014
要注意格式,最后一行也要输出两个换行,笔者就因此而PE。
此题用了c++的bitset类,貌似用碾转相余的方法更方便便捷。
#include<cstdio>#include<bitset>using namespace std;int main(){ int S, M, cnt; bitset<100001> bs; //freopen("in.txt", "r", stdin); while(scanf("%d %d", &S, &M)==2) { //static int flag = 0; bs.reset(); cnt = S%M; while(!bs.test(cnt)) { bs.set(cnt); cnt = (cnt + S) % M; } //if(flag) // printf("\n"); if((int)bs.count() == M) { printf("%10d%10d Good Choice\n\n", S, M); } else { printf("%10d%10d Bad Choice\n\n", S, M); } //++flag; } return 0;}
- HDOJ 1014 Uniform Generator
- 【HDOJ】1014 -> Uniform Generator
- hdoj 1014 Uniform Generator
- HDOJ-1014 Uniform Generator
- HDOJ 1014 Uniform Generator
- hdoj 1014 Uniform Generator
- HDOJ 1014 Uniform Generator
- Hdoj 1014 Uniform Generator
- 【HDOJ】【1014】Uniform Generator
- hdoj 1014Uniform Generator
- HDOJ 1014 Uniform Generator
- hdoj 1014 Uniform Generator
- hdoj.1014 Uniform Generator 20140809
- HDOJ 1014 Uniform Generator(公约数问题)
- hdoj 1014 uniform generator(水题)
- HDOJ Uniform Generator
- ACM--公约数为1--HDOJ 1014--Uniform Generator--水
- 1014 Uniform Generator
- phpstorm注册码
- 淘宝基金相对传统基金有没有优势
- uva 488
- java中的File 类的一些用法记录
- 使用 Socket 通信实现 FTP 客户端程序
- hdoj 1014 Uniform Generator
- 概念积累
- 解决文件上传的同时,读取文件为空的思路
- 如何使用DirectDraw直接显示RGB、YUV视频数据(播放yuv)
- 快速切换IP地址
- 使用putty连接虚拟机(centos)
- 单链表头插法
- java 日期时间 ,实现sybase dateadd函数
- 基于DirectShow的MPEG-4视频传输系统的研究与实现