zoukankan      html  css  js  c++  java
  • codeforces B. George and Round 解题报告

    题目链接:http://codeforces.com/contest/387/problem/B

    题目意思:给出1~n个问题,以及要满足是good rounde条件下这n个问题分别需要达到的complexity,最后还有George已经准备好的关于这些问题的m个complexity。问George要come up with的问题最少有多少个。

           很明显要使问题最少,那么满足每个问题的complexity为一个即可。解决这个问题的关键是要理解这句话:He can simplify any already prepared problem with complexity c to any positive integer complexity d (c ≥ d)。这句话说明不需要come up with的条件,也就是只要准备的complexity >= 需要达到的complexity就不需要提出。如果全部prepared 的 problem里面都比需要的complexity 小,那么n个问题都需要重新提出新的complexity。

         

     1 #include <iostream>
     2 #include <cstdio>
     3 using namespace std;
     4 
     5 const int maxn = 3000 + 10;
     6 int a[maxn];
     7 
     8 int main()
     9 {
    10     int n, m, i, j, tmp, cnt;
    11     while (scanf("%d%d", &n, &m) != EOF)
    12     {
    13         for (i = 1; i <= n; i++)
    14             scanf("%d", &a[i]);
    15         cnt = 0;
    16         for (i=j=1; j <= m; j++)
    17         {
    18             scanf("%d", &tmp);
    19             if (i <= n && tmp >= a[i])
    20             {
    21                 cnt++;
    22                 i++;
    23             }
    24         }
    25         printf("%d
    ", n-cnt);
    26     }
    27     return 0;
    28 } 
    29     
  • 相关阅读:
    Zoj 3511 线段树
    HDU 3340 Rain in ACStar 线段树+简单几何?
    BZOJ 2282 & 树的直径
    BZOJ 1121 & science
    BZOJ 1067 & Interval_Tree
    BZOJ 1001 & SPFA
    UVa 11181 条件概率
    并查集——启发式合并,路径压缩
    GSS系列(1)——GSS1&&GSS3
    评测脚本
  • 原文地址:https://www.cnblogs.com/windysai/p/3537246.html
Copyright © 2011-2022 走看看