hdu1210Eddy's 洗牌问题 和 hdu 1209 Ignatius and the Princess IV 和hdu 1273漫步森林
来源:互联网 发布:降龙990数据恢复 编辑:程序博客网 时间:2024/05/28 15:07
hdu1210Eddy's 洗牌问题
//求交叉换位循环最后和原串相同的次数
#include <iostream>#include <string>#include <map>using namespace std;int main(){int n, i,j,k;int maxN, num;while(scanf("%d", &n) != EOF){ n *= 2;i = 1;num = 0;do{i = 2 * i % (n + 1);num++;}while( i != 1);printf("%d\n", num);}return 0;}
hdu 1029 Ignatius and the Princess IV
//求数组中出现次数过半的数
#include <iostream>#include <string>#include <map>using namespace std;int main(){int n, i, cur;int maxN, num;while(scanf("%d", &n) != EOF){scanf("%d", &maxN);num = 1;for (i = 1;i < n; ++i){scanf("%d", &cur);if (num == 0){num = 1;maxN = cur;}else{if (cur != maxN){num--;}else{num++;}}}printf("%d\n", maxN);}return 0;}
//hdu 1273漫步森林
#include <iostream>using namespace std;//一笔画的方式有多少种//就是每个节点的度数的一半//因为每次完整的一笔画都要消耗每个节点的2个度数int main(){int n;while(scanf("%d", &n) != EOF && n){printf("%d\n", (n - 1 ) /2);}return 0;}
- hdu1210Eddy's 洗牌问题 和 hdu 1209 Ignatius and the Princess IV 和hdu 1273漫步森林
- hdu 1029 Ignatius and the Princess IV
- HDU 1029 Ignatius and the Princess IV
- HDU 1029 Ignatius and the Princess IV
- HDU 1029 Ignatius and the Princess IV
- hdu 1029 Ignatius and the Princess IV
- hdu 1029 Ignatius and the Princess IV
- hdu 1029 Ignatius and the Princess IV
- hdu 1029 Ignatius and the Princess IV
- Ignatius and the Princess IV hdu 1029
- hdu 1029 Ignatius and the Princess IV
- HDU 1029 Ignatius and the Princess IV
- HDU 1029 Ignatius and the Princess IV
- hdu 1029 Ignatius and the Princess IV
- hdu 1029 Ignatius and the Princess IV
- HDU 1029 Ignatius and the Princess IV
- HDU-1029-Ignatius and the Princess IV
- HDU--1029--Ignatius and the Princess IV
- test.axf: Error: L6238E: cpu_asm.o(test) contains invalid call from '~PRES8
- 阿里巴巴2013笔试题
- 九九乘法表的各种输出形式(C)
- 程序员求职之道(《程序员面试笔试宝典》)之看着别人手拿大把的offer,不淡定了怎么办?
- 程序地址重定位和模块绑定
- hdu1210Eddy's 洗牌问题 和 hdu 1209 Ignatius and the Princess IV 和hdu 1273漫步森林
- C++ 回调函数学习笔记
- 怎样安装Ruby development kit
- 2013.9.10 反射的实际应用
- C# 未能加载文件或程序集“MySQLDriverCS..." 错误解决
- MD5算法简单实现
- 生命中
- java 声音的播放与录制
- C++运算符重载的方法