100 Accepted

foo.cc: In function 'int main()':
foo.cc:5:11: warning: unused variable 's' [-Wunused-variable]
     int n,s;
           ^
# 状态 分数 耗时 内存占用
#1 Accepted 10 1ms 7.6 MiB
#2 Accepted 10 1ms 7.5 MiB
#3 Accepted 10 1ms 7.6 MiB
#4 Accepted 10 1ms 7.4 MiB
#5 Accepted 10 1ms 7.4 MiB
#6 Accepted 10 1ms 7.4 MiB
#7 Accepted 10 0ms 7.5 MiB
#8 Accepted 10 1ms 7.5 MiB
#9 Accepted 10 1ms 7.6 MiB
#10 Accepted 10 1ms 7.4 MiB

代码

#include <iostream>
using namespace std;
int main()
{
    int n,s;
    cin >> n;
    while (n != 1)
    {
        cout << n;
        if (n% 2 == 0)
        {
            cout << "/2=";
            n/=2;
        }
        else
        {
            cout << "*3+1=";
            n = n*3+1;
        }
        cout << n << endl;
    }
    cout << "End" << endl;
}

信息

递交者
题目
DJKS1004  角谷猜想
比赛
2024年3月等考一级题单
语言
C++ 14
递交时间
1 年前
评测时间
1 年前
分数
100
总耗时
8ms
峰值内存
7.6 MiB