zoukankan      html  css  js  c++  java
  • Let the Balloon Rise (STL)

    Contest time again! How excited it is to see balloons floating around. But to tell you a secret, the judges' favorite time is guessing the most popular problem. When the contest is over, they will count the balloons of each color and find the result.

    This year, they decide to leave this lovely job to you.


    Input

    Input contains multiple test cases. Each test case starts with a number N (0 < N < 1000) -- the total number of balloons distributed. The next N lines contain one color each. The color of a balloon is a string of up to 15 lower-case letters.

    A test case with N = 0 terminates the input and this test case is not to be processed.


    <b< dd="">

    Output

    For each case, print the color of balloon for the most popular problem on a single line. It is guaranteed that there is a unique solution for each test case.


    <b< dd="">

    Sample Input

    5
    green
    red
    blue
    red
    red
    3
    pink
    orange
    pink
    0


    <b< dd="">

    Sample Output

    red
    pink

    #include <bits/stdc++.h>
    using namespace std;
    const int maxn = 1e6+10;
    const int INF =0x3f3f3f3f;
    //#define LOCAL
    #define FOR(i,start,end) for(int i=start;i<=end;i++)
    #define FOR_(i,end,start) for(int i=end;i>=start;i--)
    #define TLE ios::sync_with_stdio(false)
    #define cc cout<<
    typedef long long ll;
    typedef struct node
    {
        char ch;
        struct node *l,*r;
    } node , *link;
    node no[60];
    string s1,s2;
    int j=0;
    void  creat(int st , int en)
    {
        int i;
        if(st>en) return ;
        for(i=0;i<en;i++)
            if(s2[i]==s1[j])
                break;
        j++;
        creat(st,i-1);
        creat (i+1,en);
        cout<<s2[i];
    }
    
    int main()
    {
        while(cin>>s1>>s2)
        {
            j=0;
            creat( 0,s2.length()-1 );
            cc  endl;
        }
    }
    所遇皆星河
  • 相关阅读:
    Silverlight未能加载文件或程序集“XXX”或它的某一个依赖项。系统找不到指定的文件。
    Silverlight button样式
    全局变量的优缺点
    安装、卸载WINDOWS 服务
    递归
    数组常用api
    节流函数&防抖函数 柯里化函数
    数组
    js无缝轮播 和淡入淡出轮播
    作用域链和域解析
  • 原文地址:https://www.cnblogs.com/Shallow-dream/p/11632224.html
Copyright © 2011-2022 走看看