zoukankan      html  css  js  c++  java
  • Codeforces Gym 100269A Arrangement of Contest 水题

    Problem A. Arrangement of Contest

    题目连接:

    http://codeforces.com/gym/100269/attachments

    Description

    Little Dmitry and little Petr want to arrange a contest. Their little friends submitted several task
    proposals and now Dmitry and Petr want to select some of them for the contest. As they are just little
    boys, they cannot estimate quality of tasks, but they know for sure that in good contest title of the first
    problem starts with A, the title of the second one — with B, and so on.
    Given titles of the proposed tasks, help little brothers to determine the maximal number of problems in
    a good contest they can arrange.

    Input

    The first line contains single integer n — the number of problem proposals received by the little
    brothers (1 ≤ n ≤ 100).
    Next n lines contain titles of proposed problems, one per line. The length of each title does not exceed
    30 characters. Each title starts with an uppercase letter and contains only English letters, digits and
    underscores.

    Output

    Output a single number — the maximal number of problems in a good contest. In case there is no good
    contest that may be arranged, output 0.

    Sample Input

    12
    Arrangement of Contest
    Ballot Analyzing Device
    Correcting Curiosity
    Dwarf Tower
    Energy Tycoon
    Flight Boarding Optimization
    Garage
    Heavy Chain Clusterization
    Intellectual Property
    J
    Kids in a Friendly Class
    Lonely Mountain

    Sample Output

    12

    Hint

    题意

    问这些句子的首字母最长连接到什么位置……

    题解:

    阅读题

    代码

    #include<bits/stdc++.h>
    using namespace std;
    
    int num = 0;
    int ans = 0;
    string s;
    int vis[30];
    int main()
    {
        freopen("arrange.in","r",stdin);
        freopen("arrange.out","w",stdout);
        int n;
        scanf("%d",&n);
        for(int i=1;i<=n;i++)
        {
            cin>>s;
            vis[s[0]-'A']=1;
        }
        for(int i=0;i<27;i++)
            if(vis[i]==0)
            {
                cout<<i<<endl;
                return 0;
            }
    }
  • 相关阅读:
    【JavaScript基础#2】
    【JavaScript基础#1】
    【2020-05-14】不选择就是一种选择
    【2020-05-13】当前最大价值的提升
    【2020-05-12】做事就是做人
    【2020-05-11】是爱,让我发现了当下风景的眼光
    【2020-05-10】人生十三信条
    【2020-05-09】干中学的又一思考
    【2020-05-08】当前手上拿的,永远都是最好的牌
    【2020-05-07】修炼心态的调整
  • 原文地址:https://www.cnblogs.com/qscqesze/p/5199495.html
Copyright © 2011-2022 走看看