ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#152561 | #958. 角谷猜想 | 13915580252 | 100 | 0ms | 1200kb | C++ | 314b | 2022-08-01 10:07:06 | 2022-08-01 10:07:08 |
answer
#include<bits/stdc++.h>
using namespace std;
int n, cnt;
int main()
{
cin >> n ;
if(n == 1)
{
cout << 0 ;
return 0;
}
while(cnt <= 1000)
{
if(n % 2)
n = n * 3 + 1;
else
n /= 2;
cnt++;
if(n == 1)
{
cout << cnt ;
return 0;
}
}
cout << "No" ;
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 0ms
memory: 1200kb
input:
7
output:
16
result:
ok single line: '16'
Test #2:
score: 10
Accepted
time: 0ms
memory: 1196kb
input:
100
output:
25
result:
ok single line: '25'
Test #3:
score: 10
Accepted
time: 0ms
memory: 1200kb
input:
84876181
output:
73
result:
ok single line: '73'
Test #4:
score: 10
Accepted
time: 0ms
memory: 1196kb
input:
13860683
output:
104
result:
ok single line: '104'
Test #5:
score: 10
Accepted
time: 0ms
memory: 1200kb
input:
39698190
output:
90
result:
ok single line: '90'
Test #6:
score: 10
Accepted
time: 0ms
memory: 1200kb
input:
24806387
output:
110
result:
ok single line: '110'
Test #7:
score: 10
Accepted
time: 0ms
memory: 1196kb
input:
47130173
output:
98
result:
ok single line: '98'
Test #8:
score: 10
Accepted
time: 0ms
memory: 1196kb
input:
42987824
output:
98
result:
ok single line: '98'
Test #9:
score: 10
Accepted
time: 0ms
memory: 1196kb
input:
19041139
output:
164
result:
ok single line: '164'
Test #10:
score: 10
Accepted
time: 0ms
memory: 1200kb
input:
72460724
output:
140
result:
ok single line: '140'