8VC Venture Cup 2016 - Final Round (Div. 2 Edition) A. Orchestra 水题
A. Orchestra
题目连接:
http://www.codeforces.com/contest/635/problem/A
Description
Paul is at the orchestra. The string section is arranged in an r × c rectangular grid and is filled with violinists with the exception of n violists. Paul really likes violas, so he would like to take a picture including at least k of them. Paul can take a picture of any axis-parallel rectangle in the orchestra. Count the number of possible pictures that Paul can take.
Two pictures are considered to be different if the coordinates of corresponding rectangles are different.
Input
The first line of input contains four space-separated integers r, c, n, k (1 ≤ r, c, n ≤ 10, 1 ≤ k ≤ n) — the number of rows and columns of the string section, the total number of violas, and the minimum number of violas Paul would like in his photograph, respectively.
The next n lines each contain two integers xi and yi (1 ≤ xi ≤ r, 1 ≤ yi ≤ c): the position of the i-th viola. It is guaranteed that no location appears more than once in the input.
Output
Print a single integer — the number of photographs Paul can take which include at least k violas.
Sample Input
2 2 1 1
1 2
Sample Output
4
Hint
题意
有一个r*c的矩阵,然后有n个点是特殊的点
然后问你里面有多少个子矩阵,其中至少有k个特殊的点
题解:
数据范围一看,才10
想怎么做就怎么做,瞎JB做就好了。
代码
#include<bits/stdc++.h>
using namespace std;
const int maxn = 12;
int a[maxn][maxn];
int r,c,n,k;
int cal(int x,int x1,int y,int y1)
{
int ans = 0;
for(int i=x;i<=x1;i++)
for(int j=y;j<=y1;j++)
if(a[i][j])ans++;
return ans;
}
int main()
{
scanf("%d%d%d%d",&r,&c,&n,&k);
for(int i=1;i<=n;i++)
{
int x,y;
scanf("%d%d",&x,&y);
a[x][y]=1;
}
int ans = 0;
for(int i=1;i<=r;i++)for(int j=i;j<=r;j++)
for(int i1=1;i1<=c;i1++)for(int j1=i1;j1<=c;j1++)
if(cal(i,j,i1,j1)>=k)ans++;
cout<<ans<<endl;
}
8VC Venture Cup 2016 - Final Round (Div. 2 Edition) A. Orchestra 水题的更多相关文章
- 8VC Venture Cup 2016 - Final Round (Div. 2 Edition)
暴力 A - Orchestra import java.io.*; import java.util.*; public class Main { public static void main(S ...
- 8VC Venture Cup 2016 - Final Round (Div. 1 Edition) E - Preorder Test 树形dp
E - Preorder Test 思路:想到二分答案了之后就不难啦, 对于每个答案用树形dp取check, 如果二分的值是val, dp[ i ]表示 i 这棵子树答案不低于val的可以访问的 最多 ...
- 8VC Venture Cup 2016 - Final Round (Div. 2 Edition) A
A. Orchestra time limit per test 2 seconds memory limit per test 256 megabytes input standard input ...
- 8VC Venture Cup 2016 - Final Round (Div. 2 Edition) D. Factory Repairs 树状数组
D. Factory Repairs 题目连接: http://www.codeforces.com/contest/635/problem/D Description A factory produ ...
- 8VC Venture Cup 2016 - Final Round (Div. 2 Edition) C. XOR Equation 数学
C. XOR Equation 题目连接: http://www.codeforces.com/contest/635/problem/C Description Two positive integ ...
- 8VC Venture Cup 2016 - Final Round (Div. 2 Edition)B. sland Puzzle 水题
B. sland Puzzle 题目连接: http://www.codeforces.com/contest/635/problem/B Description A remote island ch ...
- Codeforces Round #393 (Div. 2) (8VC Venture Cup 2017 - Final Round Div. 2 Edition) E - Nikita and stack 线段树好题
http://codeforces.com/contest/760/problem/E 题目大意:现在对栈有m个操作,但是顺序是乱的,现在每输入一个操作要求你输出当前的栈顶, 注意,已有操作要按它们的 ...
- Codeforces Round #393 (Div. 2) (8VC Venture Cup 2017 - Final Round Div. 2 Edition) D - Travel Card
D - Travel Card 思路:dp,类似于单调队列优化. 其实可以写的更简单... #include<bits/stdc++.h> #define LL long long #de ...
- Codeforces Round #393 (Div. 2) (8VC Venture Cup 2017 - Final Round Div. 2 Edition)A 水 B 二分 C并查集
A. Petr and a calendar time limit per test 2 seconds memory limit per test 256 megabytes input stand ...
随机推荐
- hadoop入门学习
hadoop入门学习:http://edu.csdn.net/course/detail/1397hadoop hadoop2视频:http://pan.baidu.com/s/1o6uy7Q6HDF ...
- GNU Readline 库及编程简介【转】
转自:https://www.cnblogs.com/hazir/p/instruction_to_readline.html 用过 Bash 命令行的一定知道,Bash 有几个特性: TAB 键可以 ...
- PHP 接入(第三方登录)QQ 登录 OAuth2.0 过程中遇到的坑
前言 绝大多数网站都集成了第三方登录,降低了注册门槛,增强了用户体验.最近看了看 QQ 互联上 QQ 登录的接口文档.接入 QQ 登录的一般流程是这样的:先申请开发者 -> 然后创建应用(拿到一 ...
- Qualcomm platform, the commonly used parameters of charger and battery in device tree file
Platform MSM8917 PM8937 PMI8940 Parameters 1 battery charging voltage : qcom,float-voltage-mv = < ...
- c语言简单实现telnet客户端
c语言简单实现telnet客户端 http://blog.csdn.net/haiwenchen/article/details/69944118
- 【2017 Multi-University Training Contest - Team 1】小结
啊人生第一次打多校被虐 紧随yql的脚步做题. 1001: 可以发现我们平时表示的数都是$x*log_{10}{10}$,所以类似于做一个换底公式就可以了. -1是一个烟雾弹,因为小学生都知道2^n不 ...
- [New learn]GCD的卡死现象分析研究
https://github.com/xufeng79x/GCDDemo 1.简介 前接[New learn]GCD的基本使用,我们分析了GCD的一般使用方法,其中比较特殊的是在分析到主队列的时候发生 ...
- squid 代理服务
squid代理服务分为两种方式: 一.正向代理(用在企业的办公环境中,员工上网需要通过Squid代理来上网) 客户端发送请求到代理服务器,代理服务器去向真正的服务器请求结果,并将结果返回给客户端 二. ...
- 《逐梦旅程 WINDOWS游戏编程之从零开始》笔记6——四大变换&光照与材质
第13章 四大变换 在Direct3D中,如果为进行任何空间坐标变换而直接绘图的话,图形将始终处于应用程序窗口的中心位置,默认这个位置就成为世界坐标系的原点(0,0,0).而且我们也不能改变观察图形的 ...
- 《java并发编程实战》读书笔记4--基础构建模块,java中的同步容器类&并发容器类&同步工具类,消费者模式
上一章说道委托是创建线程安全类的一个最有效策略,只需让现有的线程安全的类管理所有的状态即可.那么这章便说的是怎么利用java平台类库的并发基础构建模块呢? 5.1 同步容器类 包括Vector和Has ...