cainiaobanzhuan @ 2022-11-12 11:55:49
#include<stdio.h>
int main()
{
double d;
int c;
scanf("%lf",&d);
c=(int)d;
printf("%d",c);
return 0;
}
by pengzihao @ 2022-11-12 12:03:00
把(int)d;
改成(long long)d;
by pengzihao @ 2022-11-12 12:06:14
变量c
的类型也改成long long
by cainiaobanzhuan @ 2022-11-12 12:27:41
@pengzihao
通过了,超级感谢大佬!!
by icepointA @ 2022-11-29 21:29:57
#include<stdio.h>
int main()
{
double d;
long long c;
scanf("%lf",&d);
c=(long long)d;
printf("%lld",c);
return 0;
}
by ALZA @ 2023-01-17 00:26:53
@icepointA 你好,请问为什么用double,这里不是说要用单精度浮点数吗???我用float没通过,用double就可以(大哭)这是为什么呢?求大佬教教
by icepointA @ 2023-01-20 23:28:21
因为虽然题目里说的是单精度(float),但要用双精度(double)系统才算你对。
用float这个题目里面精度不够,所以一般建议通常用double,除非考虑到时间和内存的问题!
by icepointA @ 2023-01-20 23:28:52
@ALZA
by niBuohZ @ 2023-03-22 20:50:39
谢谢大佬
by ALZA @ 2023-04-08 10:34:00
@icepointA 好的!非常感谢!