大佬们,求助!!为什么是五wa

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

pi0v0 @ 2023-11-10 14:21:28

#include<cstdio>

using namespace std;

int main()
{
    int i,temp,res = 0;
    float a;
    scanf("%f", &a);
    a *= 10;
    temp = a;
    for (i = 0; i < 4; i++) {
        res += temp % 10;
        temp /= 10;
        res *= 10;
    }
    a = res;
    printf("%.1f", a/100 );

    return 0;
}

by windows_fleon @ 2023-11-10 14:29:24

小数点也要动

input: 114.5

answer: 5.411

output: 541.1


by windows_fleon @ 2023-11-10 14:35:23

@pi0v0 answer是正确答案,output是你的输出


by pi0v0 @ 2023-11-10 14:44:32

@windows_fleon 哦哦哦,发现了,谢谢啦。不愧是智慧之神(doge)


by _fox_ @ 2023-12-12 21:30:20

@pi0v0 玩O神玩的(无恶意


|