算法学习
haoduoyin1iugou
这个作者很懒,什么都没留下…
展开
-
Hello 2022
B. Integers Shoptime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe integers shop sells nsegments. The i-th of them contains all integers from li to ri and costs cicoins.Tomorrow Vasya wi原创 2022-01-04 01:58:44 · 261 阅读 · 0 评论 -
交互题学习
刷1600分题的时候发现一道交互题,以前没有练过。cf 719 f1#include<bits/stdc++.h>#define int long longusing namespace std;inline int read() { int x=0,f=1; char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} while(ch&原创 2021-06-16 00:31:41 · 140 阅读 · 0 评论 -
NEUQ-2021自主学习训练-4
B - TrianglesThis is a simple problem. Given two triangles A and B, you should determine they are intersect, contain or disjoint. (Public edge or point are treated as intersect.)InputFirst line contains an integer T (1 ≤ T ≤ 10), represents there are T原创 2021-05-05 22:43:18 · 78 阅读 · 0 评论 -
数论1
869. 试除法求约数 题目 提交记录 讨论 题解 视频讲解给定 n 个正整数 ai,对于每个整数 ai,请你按照从小到大的顺序输出它的所有约数。输入格式第一行包含整数 n。接下来 n 行,每行包含一个整数 ai。输出格式输出共 n 行,其中第 i 行输出第 i 个整数 ai 的所有约数。数据范围1≤n≤100,2≤ai≤2×109输入样例:268输出样例:1 2 3 6 1 2 4 8原创 2021-04-27 22:07:35 · 121 阅读 · 0 评论 -
NEUQ-2021自主学习训练-2
A. Almost Rectangle 源自cf #713 div3time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere is a square field of size n×nn×n in which two cells are marked. These cells can be in the same row or col原创 2021-04-19 21:47:18 · 159 阅读 · 0 评论 -
简单DP
洛谷P1802#include<bits/stdc++.h>using namespace std;typedef long long ll;const int maxn=1010;ll lose[maxn],win[maxn],use[maxn];ll f[maxn][maxn];int main(){ int n,x; cin>>n>>x; for(int i=1;i<=n;++i){ scanf("%ld%ld%ld",&原创 2021-04-15 23:08:03 · 68 阅读 · 0 评论 -
从一道试题学习pair和set的用法
试题 历届试题 平面切分资源限制时间限制:1.0s 内存限制:256.0MB问题描述平面上有n 条直线,其中第i 条直线是y=ai*x+bi 。请计算这些直线将平面分成了几个部分。输入格式第一行包含一个整数n 。以下N行,每行包含两个整数ai,bi 。输出格式一个整数代表答案。样例输入31 12 23 3Data样例输出6#include<bits/stdc++.h>using namespace std;typedef long long ll原创 2021-04-07 19:56:59 · 172 阅读 · 0 评论 -
2021-04-06
试题 历届试题 数字三角形资源限制时间限制:1.0s 内存限制:256.0MB问题描述上图给出了一个数字三角形。从三角形的顶部到底部有很多条不同的路径。对于每条路径,把路径上面的数加起来可以得到一个和,你的任务就是找到最大的和。路径上的每一步只能从一个数走到下一层和它最近的左边的那个数或者右边的那个数。此外,向左下走的次数与向右下走的次数相差不能超过 1。输入格式输入的第一行包含一个整数 ,表示三角形的行数。下面的 行给出数字三角形。数字三角形上的数都是 至 之间的整数。输出格式原创 2021-04-06 20:16:30 · 63 阅读 · 0 评论 -
树状数组和线段树
树状数组和线段树EG1:动态求连续区间和给定 n 个数组成的一个数列,规定有两种操作,一是修改某个元素,二是求子数列 [a,b] 的连续和。输入格式第一行包含两个整数 n 和 m,分别表示数的个数和操作次数。第二行包含 n 个整数,表示完整数列。接下来 m 行,每行包含三个整数 k,a,b (k=0,表示求子数列[a,b]的和;k=1,表示第 a 个数加 b)。数列从 1 开始计数。输出格式输出若干行数字,表示 k=0 时,对应的子数列 [a,b] 的连续和。数据范围1≤n≤10000原创 2021-04-05 21:12:45 · 319 阅读 · 0 评论