1 条题解

  • 0
    @ 2023-1-12 9:23:18

    按照题意模拟即可。

    #include <cstdio>
    using namespace std;
    int main() {
    	int n;
    	scanf("%d", &n);
    	while (n != 1) {
    		if (n & 1)
    			printf("%d*3+1=%d\n", n, n * 3 + 1), n = n * 3 + 1;
    		else
    			printf("%d/2=%d\n", n, n >> 1), n >>= 1;
    	}
    	return 0;
    }
    
    • 1

    信息

    ID
    13
    时间
    1000ms
    内存
    256MiB
    难度
    10
    标签
    递交数
    1
    已通过
    1
    上传者