hihoCoder太阁最新面经算法竞赛19 register

Ended

Participants:128

Verdict:Accepted
Score:100 / 100
Submitted:2016-12-18 11:34:12

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
const int MAX = 10010;
bool cmp(const string &a, const string &b){
    return a.size() > b.size();
}
bool check(const string &a, const string &b){
    int i, j = a.size() - 1;
    for(i = b.size() - 1; i >= 0 && j >= 0; --i, --j){
        while(j >= 0 && a[j] != b[i]) --j;
        if(j < 0) break;
    }
    if(i < 0) return true;
    return false;
}
int main(){
    int N; cin >> N;
    string str[MAX], rstr;
    for(int i = 0; i < N; ++i){
        cin >> str[i];
    }
    sort(str, str + N, cmp);
    cin >> rstr;
    int res = 0;
    for(int i = 0; i < N; ++i){
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX