为什么全错

B2077 角谷猜想

LHX_18460366315 @ 2023-12-31 11:40:24

全错0分,代码如下,硬是没找出一个错……

#include<bits/stdc++.h>
using namespace std;
int main(){
    long long n;
    cin >> n;
    if (n == 1){
        cout << "END";
        return 0;
    }
    for (int i = 1;n != 1;i++){
        if (n % 2 != 0){
            printf("%ld*3+1=%ld\n",n,n*3+1);
            n = n * 3 + 1;
        }else{
            printf("%ld/2=%ld\n",n,n / 2);
            n /= 2;
        }
    }
    cout << "END";
    return 0;
}

样例过了啊,没毛病啊,怎么会错呢……


by __qkj__ @ 2023-12-31 11:44:29

@ZZYX_18670145320 END改为End


by yzm0325 @ 2023-12-31 11:46:04

@ZZYX_18670145320 《END》


by LHX_18460366315 @ 2023-12-31 11:47:19

@hh6qkj Oh,thank you.


|