原题目

  Describe:普通前缀和(当然有升级版的题目,范围3000+

  code:  

#include<bits/stdc++.h>
#define maxn 1010
#define INF 1010010101
#define eps 1e-9
#define rep1(x,y) for(register int i=x;i<=y;i++)
#define rep2(x,y) for(register int j=x;j<=y;j++)
#define rep3(x,y) for(register int k=x;k<=y;k++)
#define rep4(x,y) for(register int l=x;l<=y;l++)
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef double db;
bool f[55][55];
LL r,c,n,K,s[55][55];
LL ans,now;
int x,y;
inline int read(){
int ret=0,f=1;char ch=getchar();
while (ch<'0'||ch>'9') {if (ch=='-') f=-f;ch=getchar();}
while (ch>='0'&&ch<='9') ret=ret*10+ch-'0',ch=getchar();
return ret*f;
}
inline void write(LL x){
if(x<0){putchar('-'),write(-x);return;}
if(x/10)write(x/10);putchar(x%10+'0');
}
inline double Read(){
double X=0,Y=1.0;int w=0;char ch=0;
while(!isdigit(ch)){w|=ch=='-';ch=getchar();}
while(isdigit(ch))X=X*10+(ch^48),ch=getchar();
ch=getchar();
while(isdigit(ch)) X+=(Y/=10)*(ch^48),ch=getchar();
return w?-X:X;
}
int main(){
freopen("Orchestra.in","r",stdin);
freopen("Orchestra.out","w",stdout);
r=read();c=read();n=read();K=read();
rep1(1,n)x=read(),y=read(),f[x][y]=1;
rep1(1,r)rep2(1,c){s[i][j]=s[i-1][j]+f[i][j]+s[i][j-1]-s[i-1][j-1];}
for(int i=1;i<=r;i++){
for(int j=1;j<=c;j++){
for(int k=i;k<=r;k++){
for(int l=j;l<=c;l++){
now=s[k][l]-s[i-1][l]-s[k][j-1]+s[i-1][j-1];
if(now>=K)ans++;
}
}
}
}
write(ans);
return 0;
}

  

最新文章

  1. 老王讲自制RPC框架.(四.序列化与反序列化)
  2. AC日记——最长最短单词 openjudge 1.7 25
  3. Shell脚本编程中的几个问题
  4. zookeeper清除日志文件工具
  5. AngularJS开发指南9:AngularJS作用域的详解
  6. 报错Database returned an invalid value in QuerySet.datetimes(). Are time zone definitions for your database and pytz installed?解决
  7. 牛场围栏(vijos 1054)
  8. TKinter事件及绑定
  9. 【mybaits】Mybatis中模糊查询的各种写法
  10. JS模板Handlebars的使用和有效组织
  11. Http Header Content-Disposition
  12. VirtualBox的usb支持
  13. xcode - 移动手势
  14. 关于javascript面向对象之闭包
  15. 04-OC属性的使用、自动释放池、封装和继承
  16. 【Android进阶】Activity和Fragement中onSaveInstanceState()的使用详解
  17. Window检测网络连接情况
  18. java 学习笔记之 流、文件的操作
  19. wpf研究之道-ProgressBar(进度条)控件
  20. 关于mfc学习小记(bug小记)

热门文章

  1. Java多线程信号量同步类CountDownLatch与Semaphore
  2. 二十四 Redis消息订阅&amp;事务&amp;持久化
  3. arm linux 移植支持 HP打印机
  4. Linux游戏性能再获提升
  5. app1----攻防世界
  6. node - DeprecationWarning: Mongoose: `findOneAndUpdate()` and `findOneAndDelete()` without the `use
  7. Noip2018普及组初赛试题解题报告
  8. Run K8s / 安装指南
  9. Web基础之日志
  10. duilib 之 List控件