5 条题解

  • 2
    #include <bits/stdc++.h>
    using namespace std;
    const int N=1e7+10;
    const int INF=0x3f3f3f3f;
    string c,s[200];
    int main()
    {
    	int len=1;
    	while(cin>>c)
    	{
    		s[len]=c;
    		len++; 
    	}
    	for(int i=len-1;i>=1;i--)
    	{
    		cout<<s[i]<<" ";
    	}
    	return 0;
    }
    
    
    • 2
      @ 2023-4-11 17:13:28
      #include <iostream>
      #include <string.h>
      const int N = 2e5 + 10;
      using namespace std;
      string a[N],s;
      int sum;
      int main(){
      	while (cin >> s){
      		a[++sum]=s;
      		
      	}
      	for (int i=sum;i>=1;i--)
      	   cout << a[i] << " ";
      	   return 0;
      }
      
      
      • 0
        @ 2022-2-19 11:45:53
        #include <stdio.h>
        #include <iostream>
        #include <string.h>
        const int N = 2e5 + 10;
        using namespace std;
        int main()
        {
            char a[1000];
            cin.getline(a,1000);
            int len = strlen(a);
            for(int i = len - 1;i >= 0;i--)
            {
        		if(a[i] == ' ' || i == 0)
        		{
        			int j = i + 1;
        			if(i == 0)
        				j = 0;
        			while(a[j] !=' ' && a[j] != '\0')
        			{
        				cout << a[j];
        				j++;
        			}
        			cout << " ";
        		}
        	}
        	return 0;
        }
        
        • -1
          @ 2023-4-11 17:13:06

          #include <stdio.h> #include <iostream> #include <string.h> const int N = 2e5 + 10; using namespace std; string a[N],s; int sum; int main(){ while (cin >> s){ a[++sum]=s;

          }
          for (int i=sum;i>=1;i--)
             cout << a[i] << " ";
             return 0;
          

          }

          • -5
            @ 2021-12-12 9:07:30
            #include<iostream>
            #include<vector>
            using namespace std;
            int main(){
                vector<string> word_list;
                stringword;
                while(cin>>word)
                    word_list.push_back(word);
                for(int i=word_list.size()-1; i>=0; i--)
                    cout << word_list[i] << " ";
                return 0;
            }
            
            • 1

            信息

            ID
            1093
            时间
            1000ms
            内存
            128MiB
            难度
            4
            标签
            递交数
            392
            已通过
            177
            上传者