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 水题的更多相关文章

  1. 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 ...

  2. 8VC Venture Cup 2016 - Final Round (Div. 1 Edition) E - Preorder Test 树形dp

    E - Preorder Test 思路:想到二分答案了之后就不难啦, 对于每个答案用树形dp取check, 如果二分的值是val, dp[ i ]表示 i 这棵子树答案不低于val的可以访问的 最多 ...

  3. 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 ...

  4. 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 ...

  5. 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 ...

  6. 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 ...

  7. 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个操作,但是顺序是乱的,现在每输入一个操作要求你输出当前的栈顶, 注意,已有操作要按它们的 ...

  8. 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 ...

  9. 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 ...

随机推荐

  1. st2-045漏洞利用poc

    use LWP::UserAgent; undef $/; ){print "Use:poc.pl http://target/index.action\n";exit;} my ...

  2. SIFT四部曲之——高斯滤波

    本文为原创作品,未经本人同意,禁止转载 欢迎关注我的博客:http://blog.csdn.net/hit2015spring和http://www.cnblogs.com/xujianqing/ 或 ...

  3. copy_from_user分析

    前言 copy_from_user函数的目的是从用户空间拷贝数据到内核空间,失败返回没有被拷贝的字节数,成功返回0.它内部的实现当然不仅仅拷贝数据,还需要考虑到传入的用户空间地址是否有效,比如地址是不 ...

  4. java===字符串常用API介绍(转)

    本文转自:http://blog.csdn.net/crazy_kid_hnf/article/details/55102861 字符串基本操作 1.substring(from,end)(含头不含尾 ...

  5. HDU 4305 Lightning Matrix Tree定理

    题目链接:https://vjudge.net/problem/HDU-4305 解法:首先是根据两点的距离不大于R,而且中间没有点建立一个图.之后就是求生成树计数了. Matrix-Tree定理(K ...

  6. c# 多线程多文件批量下载

    废话少说,先演示一张效果图 简单说下过程喽 开发过程中其实总是会碰到项目想应用下载文件~ 看其他语言有很多封装好的类库可以使用~~ 作为小白的我并没有找到很多c#的案例可参考 后找到一款“MutThr ...

  7. Solr产品化部署

    1.下载solr-6.4.1.tgz到任意目录 2.执行tar xzf solr-6.4.1.tgz solr-6.4.1/bin/install_solr_service.sh --strip-co ...

  8. [PAT] 1144 The Missing Number(20 分)

    1144 The Missing Number(20 分) Given N integers, you are supposed to find the smallest positive integ ...

  9. 接口测试Session/Cookie笔记(二)

    Windows系统运行计算器命令:calc python显示上一步操作命令:Alt+p python显示上一步操作结果:_(英文下划线) Session是存放在服务器的键值对 ,用于保存客户端的某个特 ...

  10. python 几种循环性能测试: while, for, 列表生成式, map等

    直接上代码: #!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/07/24 16:23 import itertools imp ...