• zju 1151--------rwkj 1332 poj1519


    #include<iostream>
    #include<string>
    #include<cstdio>
    #include<cstring>
    #include<algorithm>
    #include<sstream>
    using namespace std;
    int main()
    {    
        int t,i,n,k;
        string s,ss,s1,s2;
        while(cin>>t)
        {
            while(t--)
            {    cin>>n;
                getchar();
                while(n--)
                {    getline(cin,s);
                    stringstream ss(s);
                    i=0; k=s.size();
                    while(ss>>s2)
                    {    reverse(s2.begin(),s2.end());
                        for(;i<k;i++) 
                        {    if(s[i]==' ')  cout<<' ';
                            else break;
                        }
                        while(s[i]!=' '&&i<k) i++;
                        cout<<s2;
                    }
                    cout<<endl;
                }    
                if(t) cout<<endl;        
            }
        }
        return 0;
    }
    
        
    View Code
    #include<iostream>
    #include<string>
    #include<cstdio>
    #include<cstring>
    #include<algorithm>
    #include<sstream>
    using namespace std;
    int main()
    {
    int t,i,n,k;
    string s,ss,s1,s2;
    while(cin>>t)
    {
    while(t--)
    { cin>>n;
    getchar();
    while(n--)
    { getline(cin,s);
    stringstream ss(s);
    i=0; k=s.size();
    while(ss>>s2)
    { reverse(s2.begin(),s2.end());
    for(;i<k;i++) 
    { if(s[i]==' ')  cout<<' ';
    else break;
    }
    while(s[i]!=' '&&i<k) i++;
    cout<<s2;
    }
    cout<<endl;
    }
    if(t) cout<<endl;
    }
    }
    return 0;
    }
     
     
  • 相关阅读:
    常见试题
    Makefile学习笔记
    安装java
    IntelliJ IDEA for mac 快捷键
    JPA--Caused by: javax.persistence.PersistenceException: [PersistenceUnit: mysqlJPA] Unable to configure EntityManagerFactory
    log4j 配置
    Numbers
    mac 命令
    Intellij IDEA for mac 快捷键
    vim命令
  • 原文地址:https://www.cnblogs.com/2014acm/p/3885963.html
Copyright © 2020-2023  润新知