zoukankan      html  css  js  c++  java
  • zju 2886

    #include <iostream>
    #include <string>
    using namespace std;
    int main(int argc, char *argv[])
    {
     int i,n,m;
     string s;
     while(cin>>m)
     {
      while(m--)
      {
       cin>>s;
       n=1;
       if(s.size()==1) cout<<n<<s[0];
             for(i=0;i<s.size()-1;i++)
              if(s[i]==s[i+1]) n++;
              else {cout<<n<<s[i];n=1;}
                if(i=s.size()-1)
                 cout<<n<<s[s.size()-1];
                cout<<endl;
      }
     }
     
     return 0;
    }
    View Code

    #include <iostream>
    #include <string>
    using namespace std;
    int main(int argc, char *argv[])
    {
     int i,n,m;
     string s;
     while(cin>>m)
     {
      while(m--)
      {
       cin>>s;
       n=1;
       if(s.size()==1) cout<<n<<s[0];
             for(i=0;i<s.size()-1;i++)
              if(s[i]==s[i+1]) n++;
              else {cout<<n<<s[i];n=1;}
                if(i=s.size()-1)
                 cout<<n<<s[s.size()-1];
                cout<<endl;
      }
     }
     
     return 0;
    }

    #include<iostream>
    using namespace std;
    #include<cstring>
    #include<cstdio>
    int main()
    {
        int n,i,j,sum;
        char a[1005];
        while(cin>>n)
        {
            getchar();
            for(i=0;i<n;i++)
            {    cin>>a;
                sum=1;
                if(strlen(a)==1){ cout<<1<<a[0]<<endl;continue;}
                for(j=1;j<strlen(a);)
                {    while(a[j]==a[j-1]&&a[j]) {sum++;j++;}
                    if(a[j]!=a[j-1])
                    {    cout<<sum<<a[j-1];
                        sum=1;    
                    }
                    if(a[j]) 
                    {    if(a[j+1]==0) cout<<sum<<a[j];
                        j++;
                    }
                }
                cout<<endl;
            }
        }
        return 0;
    }
    View Code
    #include<iostream>
    using namespace std;
    #include<cstring>
    #include<cstdio>
    int main()
    {
    int n,i,j,sum;
    char a[1005];
    while(cin>>n)
    {
    getchar();
    for(i=0;i<n;i++)
    { cin>>a;
    sum=1;
    if(strlen(a)==1){ cout<<1<<a[0]<<endl;continue;}
    for(j=1;j<strlen(a);)
    { while(a[j]==a[j-1]&&a[j]) {sum++;j++;}
    if(a[j]!=a[j-1])
    { cout<<sum<<a[j-1];
    sum=1;
    }
    if(a[j]) 
    { if(a[j+1]==0) cout<<sum<<a[j];
    j++;
    }
    }
    cout<<endl;
    }
    }
    return 0;
    }
     
     
     
     
     
    #include <iostream>
    using namespace std;
    int main(int argc, char *argv[])
    {
     int n,i,sum;
     string s;
     cin>>n;
     while(n--)
     {
      cin>>s;
      for(i=0,sum=1;s[i];i++)
      {
       if(s[i]==s[i+1]) sum++;
       else
       {
        cout<<sum<<s[i];
        sum=1;
       }
      }
      cout<<endl;
     }
     return 0;
    }
    View Code

    #include <iostream>
    using namespace std;
    int main(int argc, char *argv[])
    {
     int n,i,sum;
     string s;
     cin>>n;
     while(n--)
     {
      cin>>s;
      for(i=0,sum=1;s[i];i++)
      {
       if(s[i]==s[i+1]) sum++;
       else
       {
        cout<<sum<<s[i];
        sum=1;
       }
      }
      cout<<endl;
     }
     return 0;
    }

  • 相关阅读:
    13.线性回归
    12.scikit-learn中的Scaler
    11.数据归一化
    oracle之二表的几种类型
    oracle之二表和表空间的关系
    oracle之二数据字典表和动态性能视图
    oracle之二检查点
    oracle之二管理undo
    oracle之二归档日志
    oracle之二日志挖掘log miner
  • 原文地址:https://www.cnblogs.com/2014acm/p/3885836.html
Copyright © 2011-2022 走看看