为啥是40分

B2016 浮点数向零舍入

liruizhou_lihui @ 2023-10-24 22:30:22

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

by duankh @ 2023-11-29 21:31:56

@liruizhou123


#include<iostream>
using namespace std;
int main(){
    long long x;
    cin>>x;
    cout<<x<<endl;
    return 0;
}

更简单


by 123ytq666 @ 2024-01-13 10:47:49

浮点数为什么int


by li_zehe @ 2024-03-01 19:04:20

@123ytq666 怎么说,方便取整。加油吧


|