jd123 @ 2022-09-01 14:47:26
int main(){
float m;
scanf("%f",&m);
int a,b,c,d;
float e;
a=m/100;
m=m-a*100;
b=m/10;
m=m-b*10;
c=m/1;
m=m-c;
d=m/0.1;
e=a*0.001+b*0.01+c*0.1+d*1;
printf("%f",e);
return 0;
}```
by bamboo12345 @ 2022-09-01 14:54:58
@jd123 没人跟你说只有4位啊
by jd123 @ 2022-09-01 15:00:54
@bamboo123 就针对这道题的话呢?我在后面加了%.3f,发现还有一个测试点不对,只有80分
by bamboo12345 @ 2022-09-01 15:02:21
@jd123 傻了傻了没仔细读题
by bamboo12345 @ 2022-09-01 15:05:57
@jd123 可能先把m下取整再去除(只是运算使用,不要改变m的值)会好一点
by leoqing @ 2022-09-01 16:16:12
给个关注~
#include <bits/stdc++.h>
using namespace std;
int main(){
char a,b,c,d;
scanf("%c%c%c.%c",&a,&b,&c,&d);
printf("%c.%c%c%c",d,c,b,a);
}
by _cyle_King @ 2022-09-01 16:17:30
@leoqing 别太明目张胆了。
by Syb123 @ 2022-09-02 19:20:51
@bamboo123 确实把m取整再算就对了