yangyichenSB @ 2024-08-07 21:58:13
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
while(n>1)
{
if(n%2==1)cout<<n<<"*3+1="<<n*3+1<<endl,n=n*3+1;
else cout<<n<<"/2="<<n/2<<endl,n/=2;
}
cout<<"End";
return 0;
}
为什么100分后面有两个WA
希望各大佬帮忙
by meifan666 @ 2024-08-07 22:01:40
@yangyichenSB 十年OI一场空,———————
by 枫原万叶 @ 2024-08-07 22:03:30
@yangyichenSB 不开long long见祖宗
by XLoffy @ 2024-08-07 22:06:00
@yangyichenSB 《
by yangyichenSB @ 2024-08-07 22:07:05
@meifan666
@luogu_cyx
by yangyichenSB @ 2024-08-07 22:09:16
@XLoffy 感谢,明白
by wang0212 @ 2024-09-05 01:50:18
#include <stdio.h>
int main()
{
int n,x;
scanf("%d",&n);
while(n!=1){
if(n%2==1){
x=n;
n=x*3+1;
printf("%d*3+1=%d\n",x,n);
}else {
x=n;
n=x/2;
printf("%d/2=%d\n",x,n);
}
}
printf("End\n");
return 0;
}
//求救一样100分,时间过不去!