8 条题解

  • 3
    @ 2023-12-3 16:28:29
    #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;
    }
    
    
    • 1
      @ 2025-9-19 19:55:08
      #include<bits/stdc++.h>
      using namespace std;
      string a[200];
      int cnt=0;
      int main(){
      	while (cin >> a[cnt]){
      		cnt++;
      	}
      	for(int i=cnt-1; i>=0; i--){
      		cout << a[i] << " ";
      	}
      	return 0;
      }
      

      题目

      • 0
        @ 2025-7-20 21:31:23

        #include #include #include using namespace std;

        int main() { string input; getline(cin, input);

        stack<string> wordStack;
        stringstream ss(input);
        string word;
        
        while (ss >> word) {
            wordStack.push(word);
        }
        
        bool first = true;
        while (!wordStack.empty()) {
            if (!first) cout << " ";
            first = false;
            cout << wordStack.top();
            wordStack.pop();
        }
        
        return 0;
        

        }

        language

        `
        
        
        • 0
          @ 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
            @ 2023-4-11 17:13:06

            #include <stdio.h> #include #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
                @ 2025-7-20 21:31:35

                #include #include #include using namespace std;

                int main() { string input; getline(cin, input);

                stack<string> wordStack;
                stringstream ss(input);
                string word;
                
                while (ss >> word) {
                    wordStack.push(word);
                }
                
                bool first = true;
                while (!wordStack.empty()) {
                    if (!first) cout << " ";
                    first = false;
                    cout << wordStack.top();
                    wordStack.pop();
                }
                
                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
                  难度
                  5
                  标签
                  递交数
                  539
                  已通过
                  218
                  上传者