求调

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

LtRegs @ 2024-09-21 18:36:26

#include<bits/stdc++.h> //接下来奉上全网最全c++代码
#include<assert.h>
#include<ctype.h>
#include<errno.h>
#include<ege.h>
#include<emmintrin.h>
#include<errors.h>
#include<errorrep.h>
#include<evcode.h>
#include<exception>
#include<excpt.h>
#include<exdisp.h>
#include<exdispid.h>
#include<execution>
#include<float.h>
#include<math.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<time.h>
#include<wchar.h>
#include<wchar.h>
#include<wctype.h>
#include<algorithm>
#include<bitset>
#include<cctype>
#include<cerrno>
#include<clocale>
#include<cmath>
#include<complex>
#include<cstdio>
#include<cstring>
#include<ctime>
#include<deque>
#include<execution>
#include<list>
#include<map>
#include<iomanip>
#include<ios>
#include<fenv.h>
#include<iosfwd>
#include<iostream>
#include<ostream>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<vector>
#include<cwchar>
#include<tgmath.h>
#include<utility>
#include<utime.h>
#include<commdlg.h>
#include<cassert>
#include<complex.h>

using namespace std ;

const long long max_length = 1e9 ; // 可根据实际需求调整最大长度(字符串)

double fast_double_read() //double类型下的快读代码
{
    double x = 0.0 ;
    int sign = 1 ;
    char ch = getchar() ;
    while( ch < '0' || ch > '9' )
        {
            if( ch == '-' )
                sign = - 1 ;
            ch = getchar() ;
        }
    while( ch >= '0' && ch <= '9' )
        {
            x = x * 10 + ch - '0' ;
            ch = getchar() ;
        }
    if( ch == '.' )
        {
            double frac_tion = 0.1 ;
            ch = getchar() ;
            while( ch >= '0' && ch <= '9' )
                {
                    x += ( ch - '0' ) * frac_tion ;
                    frac_tion /= 10 ;
                    ch = getchar() ;
                }
        }
    return x * sign ;
}

char fast_char_read() //char类型下的快读代码
{
    char ch = getchar() ;
    while( ch == '\n' || ch == '\r' || ch == ' ' || ch == '\t' )
        ch = getchar() ;
    return ch ;
}

int fast_int_read() //int类型下的快读代码
{
    int x = 0 ;
    int f = 1 ;
    char ch = getchar() ;
    while( ch < '0' || ch > '9' )
        {
            if( ch == '-' )
                f = -1 ;
            ch = getchar() ;
        }
    while( ch >= '0' && ch <= '9' )
        {
            x = x * 10 + ch - '0' ;
            ch = getchar() ;
        }
    return x * f ;
}

void fast_string_read( char *s ) //string类型下的快读代码
{
    char ch = getchar() ;
    int index = 0 ;
    while( ch == '\n' || ch == '\r' || ch == ' ' || ch == '\t' )
        ch = getchar() ;
    while( ch != '\n' && ch != '\r' && index < max_length - 1 )
        {
            s[index++] = ch ;
            ch = getchar() ;
        }
    s[index] = '\0' ;
} 

char s[max_length] ;

char a , b , c , d ;

int main()
{
    ios::sync_with_stdio( false ) ;
    cin.tie( 0 ) ;
    cout.tie( 0 ) ;

    a = fast_double_read() ;
    b = fast_double_read() ;
    c = fast_double_read() ;
    d = fast_double_read() ;

    cin >> a >> b >> c >> d ;
    cout << d << "." << c << b << a << "\n" ;
    return 0 ;
}

请问为啥输出不了啊,代码没问题


by shenguoyuan0901 @ 2024-10-04 20:19:11

&liuyishuo6 ,abcd似乎输了两遍


by shenguoyuan0901 @ 2024-10-04 20:20:49

@liuyishuo6 ,abcd似乎输了两遍emm搞错了


by shenguoyuan0901 @ 2024-10-04 20:22:35

#include<bits/stdc++.h>
using namespace std;
int main()
{
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);
    string s;
    cin>>s;
    for(int i=s.size()-1;i>=0;i--)
        cout<<s[i];
    return 0;
}

学过string吗


by LtRegs @ 2024-10-04 20:32:16

@shenguoyuan0901 谢谢啊


|