p5705c语言的奇怪写法

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

rinochin @ 2022-04-15 20:26:52

为啥通过不了呢?

#include<stdio.h>
int main(){
    double num1;
    scanf("%lf",&num1);
    int bai = (int)num1/100;
    int shi = ((int)num1/10)%10;
    int ge = (int)num1%10;
    double xs = num1-(bai*100+shi*10+ge);
    double num2 = xs*1000+ge*10+shi*1+bai*0.1; 
    printf("%.1f",num2);
    return 0;
}

by Jorisy @ 2022-04-15 20:29:46

你可以尝试 scanf("%d.%d",&n,&m);


by rinochin @ 2022-04-15 20:31:04

@JY 谢谢回复,我感觉自己好笨呀


by not_exist @ 2022-08-15 14:00:19

更奇怪的写法```c

include<bits/stdc++.h>

using namespace std;

int x[200][100]={0};

int main(){ string k; cin>>k; for(int i=k.length()-1;i>=0;i--){ cout<<k[i]; } return 0; }


|