![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
简单题
FightingForFinal
这个作者很懒,什么都没留下…
展开
-
UVALive7045 多少个不同的数
UVALive7045 Last Defence 题目: Given two integers A and B. Sequence S is defined as follow: S0 = A S1 = B Si = |Si−1 −Si−2| for i ≥ 2 Count the number of disti原创 2015-09-17 15:40:21 · 297 阅读 · 0 评论 -
HDU1032 The 3n + 1 problem循环次数
HDU1032 The 3n + 1 problem#include<iostream>using namespace std;int main(){ int n,cnt; cin>>n; for(cnt=0;n!=1;cnt++){ if(n%2)n=3*n+1; else n=n/2; } cout<<cnt+1;//"原创 2015-09-17 15:47:27 · 449 阅读 · 0 评论 -
HDU5375 格雷码
HDU5375 Gray code 二进制如何转换成格雷码:给二进制左端第0位补上一个0,然后从第一位开始当前一位与后一位异或,依次得到的数字就组成格雷码,格雷码的哪一位就对应于原二进制的哪一位,比如二进制01001对应的格雷码就是01101题意:把二进制c转换成格雷码,格雷码的每一位对应了一个值a,给的二进制里面含有问号,问号可以用1或0替换,然后求它转换的格雷码对应的值的和最大是多少,格雷码是原创 2015-09-17 15:41:06 · 333 阅读 · 0 评论