6 条题解

  • 3
    @ 2022-2-19 10:32:05
    #include<bits/stdc++.h>
    using namespace std;
    const int N = 2e5 + 10;
    char a[N];
    int main()
    {
        cout << "\0";
        int t;
        cin >> t;
        getchar();
        while(t--)
        {
            cin.getline(a,N);
            int len = strlen(a);
            for(int i = 0; i <= len; i++)
            {
                if(a[i] == ' ' || a[i] == '\0')
                {
                    int j = i - 1;
                    while(j >= 0 && a[j] != ' ')
                    {
                        cout << a[j];
                        j--;
                    }
                    cout << " ";
                }
            }
            cout << endl;
        }
        return 0;
    }
    
    • 3
      @ 2022-2-19 10:31:09
      /*
      #include <stdio.h>
      #include <iostream>
      #include <string.h>
      using namespace std;
      char a[1000000];
      int main()
      {
      	int t;
      	cin>>t;
      	getchar();
      	while(t--)
      	{
      		cin.getline(a,1000000);
      		int len=strlen(a);
      		for(int i=0;i<=len;i++)
      		{
      			if(a[i]==' '||a[i]=='\0')
      			{
      				int j=i-1;
      				while(j>=0&&a[j]!=' ')
      				{
      					cout<<a[j];
      					j--;
      				}
      				cout<<" ";
      			}
      		}
      		cout<<endl;
      	}
      }
      */
      
      • 1
        @ 2024-11-15 20:04:00
        #include <stdio.h>
        #include <iostream>
        #include <string.h>
        using namespace std;
        char a[100000],b[100000];
        int main()
        {
        	int n;
        	cin >> n;
        	getchar();
        	while(n--)
        	{
        		cin.getline(a,10000);
        		int len = strlen(a);
        		a[len] = ' ';
        		int pre = 0;
        		for(int i = 0 ; i <= len ; i++)
        		{
        			if(a[i] == ' ')
        			{
        				for(int j = i-1 ; j >= pre ; j--)
        					cout << a[j];
        				cout << ' ';
        				pre = i+1;
        			}
        		}
        		cout << endl;
        	}
        }
        abc abc abc 
        
        • 1
          #include<bits/stdc++.h>
          using namespace std;
          const int N = 2e5 + 10;
          char a[N];
          int main()
          {
              cout << "\0";
              int t;
              cin >> t;
              getchar();
              while(t--)
              {
                  cin.getline(a,N);
                  int len = strlen(a);
                  for(int i = 0; i <= len; i++)
                  {
                      if(a[i] == ' ' || a[i] == '\0')
                      {
                          int j = i - 1;
                          while(j >= 0 && a[j] != ' ')
                          {
                              cout << a[j];
                              j--;
                          }
                          cout << " ";
                      }
                  }
                  cout << endl;
              }
              return 0;
          }
          
          • 0

            本蒟蒻这道题超时了,求神犇指点 QwQ

            #include<bits/stdc++.h>
            using namespace std;
            char a[1005];
            bool A=1;
            int n;
            int main(){
            	cin>>n;
            	for(int i=1;i<=n;i++){
            		while(A){
            			cin>>a;
            			int lon=strlen(a);
            			for(int i=lon;i>=0;i--)cout<<a[i];
            			cout<<" ";
            		}
            	}
            	return 0;
            }
            
            • 0
              @ 2023-4-19 19:22:39

              while(cin.get(a)) yyds

              #include<iostream>
              #include<iomanip>
              #include<stdio.h>
              #include<math.h>
              #include<string>
              #include<string.h>
              #include<sstream>
              #include<algorithm>
              using namespace std;
              typedef long long ll;
              const int N=1e5+1;
              const int INF=0x3f3f3f3f;
              char a;
              string s;
              int main(){
                  int x;//没什么用
                  cin>>x;
                  cin.get(a);//注意
              	while(cin.get(a)){
              		if(a==' '||a=='\n'){
              			for(int i=s.size()-1;i>=0;i--)cout<<s[i];
              			s="";
              			cout<<a;
              		}else s+=a;//拼接字符串
              	}
              	return 0;
              }
              
              • 1

              信息

              ID
              1162
              时间
              1000ms
              内存
              32MiB
              难度
              6
              标签
              递交数
              629
              已通过
              201
              上传者