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。
#include <iostream>
#include <cstdio>
using namespace std; const int maxn = + ;
int a[maxn]; int main()
{
int n, m, i, j, tmp, cnt;
while (scanf("%d%d", &n, &m) != EOF)
{
for (i = ; i <= n; i++)
scanf("%d", &a[i]);
cnt = ;
for (i=j=; j <= m; j++)
{
scanf("%d", &tmp);
if (i <= n && tmp >= a[i])
{
cnt++;
i++;
}
}
printf("%d\n", n-cnt);
}
return ;
}
codeforces B. George and Round 解题报告的更多相关文章
- codeforces 467C.George and Job 解题报告
题目链接:http://codeforces.com/problemset/problem/467/C 题目意思:给出一条含有 n 个数的序列,需要从中找出 k 对,每对长度为 m 的子序列,使得 找 ...
- codeforces 476C.Dreamoon and Sums 解题报告
题目链接:http://codeforces.com/problemset/problem/476/C 题目意思:给出两个数:a 和 b,要求算出 (x/b) / (x%b) == k,其中 k 的取 ...
- codeforces 507B. Amr and Pins 解题报告
题目链接:http://codeforces.com/problemset/problem/507/B 题目意思:给出圆的半径,以及圆心坐标和最终圆心要到达的坐标位置.问最少步数是多少.移动见下图.( ...
- codeforces 500B.New Year Permutation 解题报告
题目链接:http://codeforces.com/problemset/problem/500/B 题目意思:给出一个含有 n 个数的排列:p1, p2, ..., pn-1, pn.紧接着是一个 ...
- codeforces B. Xenia and Ringroad 解题报告
题目链接:http://codeforces.com/problemset/problem/339/B 题目理解不难,这句是解题的关键 In order to complete the i-th ta ...
- codeforces 462C Appleman and Toastman 解题报告
题目链接:http://codeforces.com/problemset/problem/461/A 题目意思:给出一群由 n 个数组成的集合你,依次循环执行两种操作: (1)每次Toastman得 ...
- codeforces A. Point on Spiral 解题报告
题目链接:http://codeforces.com/problemset/problem/279/A 题目意思:给出一个坐标点(x, y),问当从(0, 0) 开始到达该点转过的拐角有多少个.(拐角 ...
- codeforces 460A Vasya and Socks 解题报告
题目链接:http://codeforces.com/problemset/problem/460/A 题目意思:有一个人有 n 对袜子,每天早上会穿一对,然后当天的晚上就会扔掉,不过他会在 m 的倍 ...
- codeforces 567D.One-Dimensional Battle Ships 解题报告
题目链接:http://codeforces.com/problemset/problem/567/D 题目意思:给出 1 * n 的 field,编号从左至右依次为 1,2,...,n.问射 m 枪 ...
随机推荐
- nginx 自签名https
繁杂的命令,以下准备写好的sh,拷贝https.sh文件,设置执行权限:chmod u+x https.sh #!/bin/sh # create self-signed server certifi ...
- [Algorithm] JavaScript Graph Data Structure
A graph is a data structure comprised of a set of nodes, also known as vertices, and a set of edges. ...
- C - The C Answer (2nd Edition) - Exercise 1-16
/* Revise the main routine of the longest-line program so it will correctly print the length of arbi ...
- flexible.js + makegrid.js 自适应布局
一,flexible.js 的使用方式: (一),引用方式 1,引用cdn地址 <script src="http://g.tbcdn.cn/mtb/lib-flexible/0.3. ...
- Android 适配器教程 (六)
我们的适配器学习已经接近尾声了.尽管这不是一个大问题,可是确实是值得学习的一块知识,回忆一下之前五讲的知识.我们已经学到了非常多东西了. 在之前五讲中.我们已经由浅入深的认识了适配器,从最简单的Lis ...
- Tachyon源代码结构分析(二)
公布人:南京大学PASA大数据实验室顾荣 前言 在上一篇<Tachyon源代码结构分析(一)>中,我们介绍了Tachyon的四大模块(Client模块.Master模块.Worker模块以 ...
- HAProxy简单使用
一.HAProxy简介及定位 HAProxy 是一款基于TCP和HTTP应用的具备高可用行且负载均衡的代理软件.HAProxy是完全免费的,借助HAProxy可以快速.可靠地提供基于T ...
- [转] git clone 远程分支
git clone只能clone远程库的master分支,无法clone所有分支,解决办法如下: 找一个干净目录,假设是git_work cd git_work git clone http://my ...
- iOS应用数据存储的经常使用方式
ios程序中数据数据存储有下列5种方式 XML属性列表(plist)归档 Preference(偏好设置) NSKeyedArchiver归档(NSCoding) SQLite3 Core Data ...
- PHP魔术方法之__call与__callStatic方法
<?php class human{ private function t(){ } //魔术方法__call /* $method 获得方法名 $arg 获得方法的参数集合 */ public ...