题解 | 卡拉兹函数

卡拉兹函数

https://www.nowcoder.com/practice/fd497366b6a54ce18698f853cc1bd503

#include<iostream>
using namespace std;
int main(){
    int n;
    cin >> n;
    if(n%2==0){
        cout << n/2;
        return 0;
    }
    cout << 3*n+1;
    return 0;
}

全部评论

相关推荐

02-11 14:29
已编辑
字节跳动_QA
Edgestr:这种的写代码最狠了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务