NanoApe Loves Sequence Ⅱ
来源:互联网 发布:钱夹式纸巾 知乎 编辑:程序博客网 时间:2024/05/16 19:43
将小于m的数为0,其余数为1,只要区间中1的个数大于k即可
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #include <queue> using namespace std; #define N 200050 int a[N]; int main() { int T,n,m,k; scanf("%d",&T); while(T--) { scanf("%d %d %d",&n,&m,&k); int t=0; long long sum=0; for(int i=1; i<=n; i++) scanf("%d",&a[i]); int r=1,num=0; for(int i=1;i<=n;i++) { while(r<=n&&num<k) { if(a[r]>=m) num++; r++; } if(num>=k) sum+=n-(r-1)+1; if(a[i]>=m) num--; } printf("%lld\n",sum); } return 0; }
1 0
- NanoApe Loves Sequence Ⅱ
- NanoApe Loves Sequence Ⅱ
- hdoj5805 NanoApe Loves Sequence && hdoj 5806 NanoApe Loves Sequence Ⅱ
- hdu NanoApe Loves Sequence Ⅱ
- HDU5806 NanoApe Loves Sequence Ⅱ
- HDOJ 5806 NanoApe Loves Sequence Ⅱ
- hdu 5806 NanoApe Loves Sequence Ⅱ
- HDU 5806 NanoApe Loves Sequence Ⅱ
- hdu 5806 NanoApe Loves Sequence Ⅱ
- HDU 5806:NanoApe Loves Sequence Ⅱ
- HDU 5806 NanoApe Loves Sequence Ⅱ
- HDU 5806 NanoApe Loves Sequence Ⅱ
- hdoj-5806-NanoApe Loves Sequence Ⅱ
- BC#86.1003(HDOJ5806)NanoApe Loves Sequence Ⅱ
- hdoj5806 NanoApe Loves Sequence Ⅱ(尺取法)
- HDU 5806 - NanoApe Loves Sequence Ⅱ
- HDU 5806 NanoApe Loves Sequence Ⅱ
- HDU 5806 NanoApe Loves Sequence Ⅱ
- 实测-用vmware把系统装到U盘
- Spring之AOP
- 图解Linux命令之--chmod命令
- VXGI 学习与测试心得分享(转自UnrealChina.Alex_Tsui)
- 数据结构实验之栈六:下一较大值(二)
- NanoApe Loves Sequence Ⅱ
- [读书笔记] 深入探索C++对象模型-第六章-执行期语义学(上)
- 第十七期 U-Boot norflash 操作原理分析 《路由器就是开发板》
- 从ACM跳槽 由算法转技术
- lightoj 1016 水贪心
- 支付宝支付接口详解
- Codeforces 632D Longest Subsequence
- java Files类和Paths类的用法
- linux 解压命令大全