这有问题??

B2077 角谷猜想

cy156 @ 2024-03-17 15:42:16

#include<iostream>
#include<string.h>
#include<algorithm>
#include<vector>
#include<math.h>
#include<iomanip>
using namespace std;

int main()
{
    long long n;
    cin>>n;
    while(n!=1)
    {
        if(n%2==0)
        {
            printf("%d/2=%d\n",n,n/2);
            n=n/2;
        }
        else
        {
            printf("%d*3+1=%d\n",n,n*3+1);
            n=n*3+1;
        }
    }
    printf("End");
    return 0;
}

by WydnksqhbD @ 2024-03-17 15:50:38

@cy156

long long


by cy156 @ 2024-03-17 15:51:30

@WydnksqhbD 开了呀


by WydnksqhbD @ 2024-03-17 15:52:15

@cy156 wssb没看到


by WydnksqhbD @ 2024-03-17 15:53:29

@cy156 等我 debug 下


by WydnksqhbD @ 2024-03-17 15:58:54

@cy156 开 long long 要用 %lld。。。


by cy156 @ 2024-03-17 16:00:41

@WydnksqhbD 哦哦,忘了


by WydnksqhbD @ 2024-03-17 16:00:59

@cy156 求壶关


by hema5177 @ 2024-03-17 16:01:17

@cy156 把printf改成cout就行了?哦我好像知道了,%d改成%lld也可以


|