0分???

B2077 角谷猜想

KokCair @ 2024-06-30 13:01:17


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

by zhangzirui66 @ 2024-06-30 13:23:58

@114514xiaohai End不是END


by MSJ2013 @ 2024-07-18 13:55:52

我的AC代码:



#include<bits/stdc++.h>
using namespace std;  
int main() {  
    long long a;  
    cin>>a;  
    while(a>1){  
        if(a%2==1){
            cout<<a<<"*3+1=<<a*3+1<<endl;
a=a*3+1;
        }
        if(a%2==0){
            cout<<a<<"/2="<<a/2<<endl;
    a=a/2; 
        }

    }
    cout<<"end";
    return 0;
}

|