[Offer收割]编程练习赛25 register

Ended

Participants:399

Verdict:Accepted
Score:100 / 100
Submitted:2017-09-03 13:19:42

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 <cstring>
#include <cstdio>
#include <map>
#include <queue>
#include <vector>
#include <algorithm>
using namespace std;
int n;
struct NameType {
    string name;
    int num;
    string name_2;
    NameType(const string& na, const int& nu, const string& nb)
    : name(na), num(nu), name_2(nb) {}
};
bool CompareNameType(const NameType& a, const NameType& b) {
    if (a.name.compare(b.name) < 0) return true;
    if (a.name.compare(b.name) > 0) return false;
    return a.num < b.num;
}
int Convert(const string& b) {
    int ret = 0;
    for (int i = 0; i < b.length(); ) {
        if (i != b.length() - 1) {
            bool need_break = false;
            if (b[i] == 'I' && b[i + 1] == 'V') {ret += 4; need_break = true;}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX