wenxuliang @ 2024-05-18 11:28:39
#include<bits/stdc++.h>
using namespace std;
long long i,j,a,b,c,d;
double n;
int main(){
cin>>n;
if(n<0)printf("%.0lf",floor(n)+1);
else printf("%.0lf",floor(n));
return 0;
}
by lizexuanaibiancheng @ 2024-05-18 11:39:14
#include<bits/stdc++.h>
using namespace std;
long long i,j,a,b,c,d;
long double n;
int main(){
cin>>n;
if(n<0&&n!=floor(n))printf("%.0Lf",floor(n)+1);
else printf("%.0Lf",floor(n));
return 0;
}
你得先判断 n !=floor(n)
),不然直接输出
by wenxuliang @ 2024-05-18 21:39:42
@lizexuanaibiancheng 感谢