为什么devc++里面能跑过,一交就wrong answer(c++)

P5705 【深基2.例7】数字反转

suzhengyang123 @ 2022-07-04 10:37:39

#include<bits/stdc++.h>
using namespace std;

int main(){
    float a;
    int a1,a2,a3,a4;
    cin >> a;
    a1=int(a*10)/1000;
    a2=int(a*10)%1000/100;
    a3=int(a*10)%100/10;
    a4=int(a*10)%10;
    cout <<a4<< a3<< a2 <<"." <<a1;
    return 0;
}

测试点是114.5,我本地跑的是541.1,到洛谷上就是5.411


by _Remake_ @ 2022-07-04 10:39:14

《devc++里面能跑过》

小数点放到a4后面


by ningago @ 2022-07-04 10:42:55

你觉得答案应该是多少……


by ShouZheng_Observer @ 2022-07-04 10:52:27

读题,看题啊!


by bigbird2444 @ 2022-07-16 10:51:51

读错题了


by Jiaxiaoyuan11 @ 2022-07-18 14:43:58

@suzhengyang123 读错题了,测试点是114.5,输出应该是5.411


|