
OJ基础题
OJ常见题目
xcatf
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
ZOJ 4117 BaoBao Loves Reading (树状数组 前缀和)
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=6019 用树状数组维护书桌整个时间段的书本数目,区间查询得到出现相同书本时的时间差,即为可以省去的去书柜拿书次数(书桌容量为即时间差),最后利用前缀和,得到容量1~n的可省次数 #include <iostream> #include <cstd...原创 2019-05-19 21:30:36 · 315 阅读 · 0 评论 -
HDU 6296 代码派对 (二维前缀和 差分)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6296 利用二维前缀和,我们可以求出每个位置sumv[i][j]被矩形覆盖的次数,然后在覆盖矩阵数里面排列组合选出3个C[sum[i][j]] 但里面会有重复。利用差分的思想,减掉去除左边,去除上边的前缀和,以及再加一次左上的前缀和(因为被减了两次) #include <iostream&...原创 2019-05-12 12:54:17 · 417 阅读 · 0 评论 -
HDU 6025 Coprime Sequence (前后缀 gcd)
#include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <map> #include <set> using namespace std; typedef long long ll; static co...原创 2019-05-02 18:41:09 · 163 阅读 · 0 评论 -
ZOJ 4109 Welcome Party (并查集 优先队列)
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=4109 并查集可以联通所有的朋友,使得生气人数最少。为了构成最小的字典序,并查集需要按秩合并(编号小的秩大),然后再用优先队列维护后面的入场顺序。 #include <iostream> #include <cstdio> #inclu...原创 2019-05-19 20:48:52 · 334 阅读 · 0 评论 -
PTA L2-005 集合相似度 (set)
L2-005集合相似度(25 分) 给定两个整数集合,它们的相似度定义为:Nc/Nt×100%。其中Nc是两个集合都有的不相等整数的个数,Nt是两个集合一共有的不相等整数的个数。你的任务就是计算任意一对给定集合的相似度。 输入格式: 输入第一行给出一个正整数N(≤50),是集合的个数。随后N行,...原创 2018-12-20 15:33:01 · 577 阅读 · 1 评论 -
HDU 1237 简单计算器 (stack)
简单计算器 Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 27155Accepted Submission(s): 9861 Pr...原创 2018-11-14 23:48:35 · 259 阅读 · 0 评论 -
HDU 4841 圆桌问题 (模拟)
圆桌问题链接 输入:n(好人数,坏人数),m(数到m杀人,接着从1开始数) 输出:G为好人,B为坏人,坏人全部会在被杀的位置。 三种实现方式: 1.最朴素的数组:(模拟整个过程) #include<iostream> #include<sstream> #include&...原创 2018-11-01 16:49:56 · 837 阅读 · 0 评论 -
POJ 1042 Gone Fishing (贪心)
Gone Fishing Description John is going on a fishing trip. He has h hours available (1 <= h <= 16), and there are n lakes in the area (2 <= n &l...原创 2018-10-11 16:15:02 · 561 阅读 · 0 评论 -
Fibonacci-ish(搜索 map)
Problem G: Fibonacci-ish Description Yash has recently learnt about the Fibonacci sequence and is very excited about it. He calls a sequence Fibonacci-ish if the sequence consists of at least two e...原创 2018-09-21 10:04:28 · 313 阅读 · 0 评论 -
Little Boxes (高精度)
Little boxes on the hillside. Little boxes made of ticky-tacky. Little boxes. Little boxes. Little boxes all the same. There are a green boxes, and b pink boxes. And c blue boxes and d yellow bo...原创 2018-09-11 22:52:45 · 959 阅读 · 0 评论 -
A × B problem (高精度)
A × B problem 输入格式 数据的第一行是整数T(1 \leq T \leq 20)T(1≤T≤20),代表测试数据的组数。接着有TT组数据,每组数据只有一行,包括两个正整数AA和BB。但AA和BB非常大,Redraiment 能保证这些数用 long 来保存一定会溢出。但AA和BB的位数最大不会超过100100位。 输出格式 对应每组测试数据,你...原创 2018-09-23 23:04:47 · 1073 阅读 · 0 评论 -
PTA L1-046 整除光棍 (高精度)
L1-046整除光棍 这里所谓的“光棍”,并不是指单身汪啦~ 说的是全部由1组成的数字,比如1、11、111、1111等。传说任何一个光棍都能被一个不以5结尾的奇数整除。比如,111111就可以被13整除。 现在,你的程序要读入一个整数x,这个整数一定是奇数并且不以5结尾。然后,经过计算,输出两个数字:第一个数字s,表示x...原创 2019-03-27 15:47:55 · 250 阅读 · 0 评论 -
牛客训练 16811 回文串 (高精度)
题目链接:https://ac.nowcoder.com/acm/problem/16811 可以直接调用string的reverse方法来翻转字符串 #include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <map>...原创 2019-05-04 14:03:22 · 189 阅读 · 0 评论