八十分,错哪了?

B2016 浮点数向零舍入

this_is_a_fool @ 2022-03-30 17:46:01

#include<bits/stdc++.h>
using namespace std;
int main(){
    double a;
    cin>>a;
    cout<<(int)a;
}

2,3点WA


by xxx听取AC声一片 @ 2022-03-30 17:49:01

数据范围要开long double


by xxx听取AC声一片 @ 2022-03-30 17:50:22

而且double我没记错是双精度浮点数,float才是单精度浮点数


by xxx听取AC声一片 @ 2022-03-30 17:52:32

啊呸,看错了,数据范围很大,要用long long (int)a 应改为 (long long)a


by _Haoomff_ @ 2022-03-30 17:53:36

十年OI一场空,不开long long见祖宗


by Walker_Sama @ 2022-05-21 22:22:03

@Haoomff 太真实了


by Chase12345 @ 2023-03-26 23:08:19

#include<stdio.h>
int main() {
    int a;
    scanf("%d",&a);
    printf("%d",a);
}

by Chase12345 @ 2023-03-26 23:08:49

@Chase12345 求大佬看一下这里错哪里了


by Xiaxinyan @ 2023-08-26 13:23:43

@Chase12345

把int 改为long long 就可以啦


|