80分求救

B2016 浮点数向零舍入

kezichen2012 @ 2024-10-03 22:06:44

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

哪位大佬教我一下


by hjzja @ 2024-10-03 22:15:43

@kezichen2012

#include <bits/stdc++.h>
using namespace std;
int main(){
    long long x;
    cin>>x;
    cout<<x;
    return 0;
}

by Jerry20140101 @ 2024-10-03 22:25:16

@kezichen2012

#include <bits/stdc++.h>
#define itn int
#define ll long long
#define ull unsigned long long
#define up(i,start,stop) for(int i = (start);i <= (stop);i++)
#define upp(j,start,stop) for(int j = (start);j <= (stop);j++)
#define down(i,start,stop) for(int i = (start);i >= (stop);i--)
#define downn(j,start,stop) for(int j = (start);j >= (stop);j--)
#define faster() ios::sync_with_stdio(false)
using namespace std;

int main () {
    float a;
    cin>>a;
    int result = static_cast<int>(a);
    cout<<result<<endl;
    return 0;
}

by wuxuanxuanxuan @ 2024-10-03 22:25:26

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


by kezichen2012 @ 2024-10-03 22:25:32

@hjzja 谢谢大佬


|