• 思维题+set URAL 1718 Rejudge


    题目传送门

     1 /*
     2     题意:数据加10组,再删掉第6组数据,问rejudge后最少最多几个作者收到邮件
     3     思维题:当错在6时结果是不一定,错在7时是一定改变,因为会变成6
     4     思路没错,但用结构题排序一直WA,代码有毒!学习使用set容器。
     5 */
     6 #include <cstdio>
     7 #include <algorithm>
     8 #include <cstring>
     9 #include <cmath>
    10 #include <string>
    11 #include <iostream>
    12 #include <set>
    13 using namespace std;
    14 
    15 const int MAXN = 1e3 + 10;
    16 const int INF = 0x3f3f3f3f;
    17 string name, res;
    18 set<string> mn, mx;
    19 
    20 int main(void)        //URAL 1718 Rejudge
    21 {
    22 //    freopen ("H.in", "r", stdin);
    23 
    24     int n;    scanf ("%d", &n);
    25     for (int i=1; i<=n; ++i)
    26     {
    27         cin >> name >> res;
    28         if (res == "CE")    continue;
    29         else if (res == "AC")
    30         {
    31             mx.insert (name);    continue;
    32         }
    33         else
    34         {
    35             int x;    scanf ("%d", &x);
    36             if (x == 6)    mx.insert (name);
    37             else if (x == 7)
    38             {
    39                 mn.insert (name);    mx.insert (name);
    40             }
    41         }
    42     }
    43 
    44     printf ("%d %d
    ", mn.size (), mx.size ());
    45 
    46     return 0;
    47 }
    编译人生,运行世界!
  • 相关阅读:
    将字符数组写到字符串
    两种比较不错的密码修改方案
    数组的应用 结构类型 使用深复制和浅复制 显示员工信息
    字符串处理技巧
    uva 1339
    11039
    uva 11636
    Uva401Palindromes
    poj2524-Ubiquitous Religions
    Poj1611The Suspects
  • 原文地址:https://www.cnblogs.com/Running-Time/p/4649534.html
Copyright © 2020-2023  润新知