求助WA

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

jzphhc @ 2024-05-22 12:14:26

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

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

by Justin_love_coding @ 2024-05-22 12:46:16

@jzphhc

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

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

by caojinyu0518 @ 2024-07-11 19:55:20

@jzphhc 可以用reverse函数

reverse(s.begin(),s.end());

by MSJ2013 @ 2024-07-18 17:55:27

我的AC代码:


#include <bits/stdc++.h>
using namespace std;
int main(){
    char a, b, c, d;
    scanf("%c%c%c.%c", &a, &b, &c, &d);
    printf("%c.%c%c%c", d, c, b, a);
    return 0;
}

|