
前缀和
数论
Aloof__
笔记是记忆的缓冲
展开
-
Educational Codeforces Round 93 (Rated for Div. 2) A~D
A - Bad Triangle因为序列是非单调递减的,那么只需要判断序列的前两个数(最小的两个数)和序列的最后一个数(最大的一个数)能否构成三角形即可;#include <bits/stdc++.h>using namespace std;int a[50005];int main(){ int t; cin >>t; while(t--) { int n; cin >>n; for(int i=1;i<=n;i++) ci.原创 2020-08-19 22:50:24 · 240 阅读 · 0 评论 -
Codeforces Round #664 (Div. 2) A~D
A. Boboniu Likes to Color Balls#include<bits/stdc++.h>using namespace std;int main(){ int t; cin>>t; while(t--) { int a,b,c,d; cin>>a>>b>>c>>d; int num=0; if(a&1) num++; if(b&1) num+.原创 2020-08-13 10:03:43 · 461 阅读 · 0 评论 -
Codeforces Round #663 (Div. 2) A~D
目录A. Suborrays(思维)B. Fix You(思维)C. Cyclic Permutations(思维,排列组合)D. 505(DP,前缀和)A. Suborrays(思维)思路:线性输出就行了;#include <bits/stdc++.h>using namespace std;int a[100010];int main(){ int t; cin >>t; while(t--) { int n;...原创 2020-08-11 22:44:01 · 291 阅读 · 0 评论 -
Codeforces Round #637 (Div. 2) C Nastya and Strange Generator
整理的算法模板:ACM算法模板总结(分类详细版)C. Nastya and Strange Generatortime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputBeing upset after thi...原创 2020-04-24 15:36:44 · 385 阅读 · 0 评论 -
Xiongnu's Land UVALive - 7261(前缀和)
Wei Qing (died 106 BC) was a military general of the Western Han dynasty whose campaigns againstthe Xiongnu earned him great acclaim. He was a relative of Emperor Wu because he was the youngerhalf-b...原创 2019-10-07 14:35:12 · 207 阅读 · 0 评论 -
Codeforces Round #632 (Div. 2) C. Eugene and an array
整理的算法模板:ACM算法模板总结(分类详细版)题目链接:http://codeforces.com/contest/1333/problem/C题意:子数组:数组a的任意一个连续的子序列,称作数组a的子数组; 好数组:数组b的任意子数组的和都不为0求出一个数组的所有好数组;思路:(昨天晚上准备开c题的时候,家里出事了,于是乎今天在医院写下这篇题解;)首先暴力绝对...原创 2020-04-09 20:23:52 · 164 阅读 · 0 评论 -
AcWing 99.激光炸弹(矩阵前缀和)
整理的算法模板:ACM算法模板总结(分类详细版)地图上有NN个目标,用整数Xi,YiXi,Yi表示目标在地图上的位置,每个目标都有一个价值WiWi。注意:不同目标可能在同一位置。现在有一种新型的激光炸弹,可以摧毁一个包含R×RR×R个位置的正方形内的所有目标。激光炸弹的投放是通过卫星定位的,但其有一个缺点,就是其爆炸范围,即那个正方形的边必须和x,yx,y轴平行。...原创 2020-04-07 15:04:18 · 282 阅读 · 0 评论