怎么全TLE?(C)

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

UTAsriel @ 2022-10-09 09:38:41


#include <stdio.h> 
int main(){
    float a;
    float b;
    int c;
    scanf("%f",&a);
    c=a*10;
    for(int i=0;i=4;i++){
    b+=(c%10);
    b*=10;
    c/=10;
    }
    b/=1000;
    printf("%f.3",b);
}

by HRQQ @ 2022-10-09 09:39:49

#include<bits/stdc++.h>
using namespace std;
int main()
{
  string a;
  cin>>a;
  reverse(a.begin(),a.end());
  cout<<a;
  return 0;
}

by HRQQ @ 2022-10-09 09:40:07

@UTAsriel


by UTAsriel @ 2022-10-09 09:42:25

@HRQQ 谢谢!


by a2lyaXNhbWUgbWFyaXNh @ 2022-10-09 10:05:25

@HRQQ 不懂就问,STL不是C++独有的吗


by UTAsriel @ 2022-10-09 10:07:26

@S__B 所以我后面把我的改了一下,没有用“HRQQ”的,不过还是要感谢一下。


by UTAsriel @ 2022-10-09 10:08:51

@S__B 修改后的:


#include <stdio.h> 
int main(){
    float a;
    float b;
    int c;
    scanf("%f",&a);
    c=a*10;
    for(int i=0;i<4;i++){
    b+=(c%10);
    b*=10;
    c/=10;
    }
    b/=10000;
    printf("%.3f",b);
}

by a2lyaXNhbWUgbWFyaXNh @ 2022-10-09 10:09:28

@UTAsriel 我知道的,不然C提交上去会CE


|