9 solutions

  • 4
    @ 2023-10-4 10:36:05
    #include<bits/stdc++.h>
    using namespace std;
    char a[10005];
    int i=0;
    int main(){
    	cin>>a[0];
    	i++;
    	while(a[i-1]!='!'){
    		cin>>a[i];
            i++;
    	}
    	for(int x=i-2;x>=0;x--) cout<<a[x];
    	return 0;
    }
    

    到现在没写过一次递归

  • 1
    @ 2024-10-22 20:16:03
    # include<bits/stdc++.h>
    using namespace std;
    int main(){
    	char a;
    	scanf("%c",&a);
    	if(a=='!')return 0;
    	main();
    	cout<<a;
    }
    
  • 1
    @ 2023-10-27 18:25:32

    短小精悍

    using namespace std;
    int main(){
    	string a;
    	cin>>a;
    	for(int i=a.size()-2;i>=0;i--) cout<<a[i];
    	return 0;
    } 
    
    • 1
      @ 2023-10-15 11:13:58
      #include<bits/stdc++.h>
      using namespace std;
      void revShow(char s[], int len)//逆向输出字符数组s,s长度为len 
      {
      	if(len == 0)
      		return;
      	cout << s[len-1];
      	revShow(s, len-1);
      }
      int main()
      {
      	char s[1005];
      	cin.getline(s, 1005);
      	int len = strlen(s);
      	s[--len] = '\0';//去掉最后的'!' 
      	revShow(s, len);
      	return 0;
      }
      
      
      • 1
        @ 2023-10-11 13:34:44
        #include <bits/stdc++.h>
        using namespace std;
        string s;
        int main(int argc, char **argv){
        	getline(cin,s);
        	int len = s.length() - 2;
        	for (int i = len;i >= 0;i--){
        		cout << s[i];
        	}
        	return 0;
        }
        

        这题不应该放在 字符串 吗?

      • 1
        @ 2023-9-29 13:37:10
        #include <set>
        #include <ios>
        #include <list>
        #include <cmath>
        #include <ctime>
        #include <queue>
        #include <deque>
        #include <stack>
        #include <vector>
        #include <bitset>
        #include <cctype>
        #include <cerrno>
        #include <cwchar>
        #include <cstdio>
        #include <fenv.h>
        #include <iosfwd>
        #include <string>
        #include <limits>
        #include <math.h>
        #include <cstdlib>
        #include <iomanip>
        #include <clocale>
        #include <complex>
        #include <cstring>
        #include <cstring>
        #include <cwctype>
        #include <istream>
        #include <ostream>
        #include <sstream>
        #include <fstream>
        #include <utility>
        #include <stdio.h>
        #include <iostream>
        #include <stdint.h>
        #include <string.h>
        #include <tgmath.h>
        #include <complex.h>
        #include <algorithm>
        #include <exception>
        #include <stdbool.h>
        #include <stdexcept>
        #include <streambuf>
        #include <functional>
        #include <inttypes.h>
        #include <bits/stdc++.h>
        using namespace std;
        int main(){
        	string s;
        	cin >> s;
        	for(int i = s.size() - 1;i >= 0;i--){
        		if(s[i] == '!') continue;
        		cout << s[i];
        	}
        	return 0;
        }`
        
        • 0
          @ 2023-12-23 21:17:16
          #include<bits/stdc++.h>
          using namespace std;
          char a[10005];
          int i=1;
          int main(){
          	cin>>a[0];
          	while(a[i-1]!='!'){
          		cin>>a[i];
                  i++;
          	}
          	for(int x=i-2;x>=0;x--) cout<<a[x];
          	return 0;
          }
          
          • 0
            @ 2023-11-15 13:20:16
            #include<iostream>
            #include<string>
            using namespace std;
            void hdx(string hn){
            	if(hn.size()==1)cout<<hn;
            	else{
            		cout<<hn[hn.size()-1];
            		string ha;
            		for(int hi=0;hi<hn.size()-1;hi++)ha+=hn[hi];
            		hdx(ha);
            	}
            }
            int main(){
            	string hn;
            	getline(cin,hn,'!');
            	hdx(hn);
            }
            
            • -1
              @ 2023-10-22 20:02:44

              #include<bits/stdc++.h> using namespace std; int main(){ string s=""; getline(cin,s); int siz=s.size(); for(int i=siz-1;i>-1;i--){ if(s[i]!='!'){ cout<<s[i]; } } return 0; }

              • 1

              Information

              ID
              648
              Time
              1000ms
              Memory
              256MiB
              Difficulty
              3
              Tags
              # Submissions
              82
              Accepted
              46
              Uploaded By