C语言新手求助,为什么运行正确,没有报错,却是0分?

B2077 角谷猜想

wuxiangtianbei @ 2022-12-05 16:18:31

#include<stdio.h>
int main()
{
long long n,a,b,i;
a=0;
scanf("%lld",&n);
while(n!=1)
{
if(n%2==1)
{
a=n;
n=n*3+1;
printf("%lld*3+1=%lld\n",a,n);
}
else 
{
b=n;
n=n/2;
printf("%lld/2=%lld\n",b,n);
}
}
printf("END\n");
}

by a2lyaXNhbWUgbWFyaXNh @ 2022-12-05 16:25:21

WA不就报错


by a2lyaXNhbWUgbWFyaXNh @ 2022-12-05 16:25:58

@wuxiangtianbei 而且是End不是END


by a2lyaXNhbWUgbWFyaXNh @ 2022-12-05 16:26:38

@wuxiangtianbei

#include<stdio.h>
int main()
{
long long n,a,b,i;
a=0;
scanf("%lld",&n);
while(n!=1)
{
if(n%2==1)
{
a=n;
n=n*3+1;
printf("%lld*3+1=%lld\n",a,n);
}
else 
{
b=n;
n=n/2;
printf("%lld/2=%lld\n",b,n);
}
}
printf("End\n");
}

by xlpri @ 2022-12-05 17:09:33

@wuxiangtianbei 建议好好读题(尤其是输出)


by wuxiangtianbei @ 2022-12-05 21:44:34

哦哦,不好意思


|