1210 eddy's 洗牌问题.c
来自「威士忌的HDU题解.大概有260多题的源码。对于学习非常有好处。」· C语言 代码 · 共 34 行
C
34 行
/*
1210 Eddy's 洗牌问题
Time Limit : 1000 ms Memory Limit : 32768 K Output Limit : 256 K
15 MS 184 KB 428 B
GUN C++
*/
#include <stdio.h>
int main()
{
int N;
int iCount;
int first;
int i;
while(scanf("%d", &N) != EOF){
iCount = 1;
first = 2;
while(first != 1){
if(first > N){
first = (first - N) * 2 - 1;
}
else{
first *= 2;
}
iCount++;
}
printf("%d\n", iCount);
}
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?