UVA习题集
等我学会后缀自动机
侠影之谜
展开
-
UVA 10417 Gift Exchanging (条件概率+坑点)(太智障了。。。。T_T)
#include<bits/stdc++.h>using namespace std;#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define lrt int l,int r,int rt#define lson l,mid,rt<<1#define rson...原创 2020-02-19 08:57:26 · 200 阅读 · 0 评论 -
uva 557 - Burger(概率+递推)
#include<bits/stdc++.h>using namespace std;#define debug cout<<"YES\n";#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define lrt int l,int r,int rt#define ...原创 2020-02-18 15:41:09 · 222 阅读 · 0 评论 -
UVA 11762 Race to 1 (期望+概率+预处理)
#include<bits/stdc++.h>using namespace std;#define debug cout<<"YES\n";#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define lrt int l,int r,int rt#define ...原创 2020-02-17 19:22:18 · 149 阅读 · 0 评论 -
UVA 10491 Cows and Cars (概率)
#include<bits/stdc++.h>using namespace std;#define debug cout<<"YES\n";#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define lrt int l,int r,int rt#define ...原创 2020-02-17 16:27:32 · 101 阅读 · 0 评论 -
UVA 11346 Probability (积分)
#include<bits/stdc++.h>using namespace std;#define debug cout<<"YES\n";#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define lrt int l,int r,int rt#define ...原创 2020-02-17 11:13:59 · 116 阅读 · 0 评论 -
UVA 542 France '98 (概率模拟)
#include<bits/stdc++.h>using namespace std;#define debug cout<<"YES\n";#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define lrt int l,int r,int rt#define ...原创 2020-02-15 23:15:43 · 124 阅读 · 0 评论 -
UVA 10277 Boastin' Red Socks (概率)
#include<bits/stdc++.h>using namespace std;#define debug cout<<"YES\n";#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define lrt int l,int r,int rt#define ...原创 2020-02-15 14:23:18 · 192 阅读 · 0 评论 -
UVA 11609 Teams (组合水题)
题目链接:https://cn.vjudge.net/problem/UVA-11609#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define read(x,y) scan...原创 2018-09-19 18:27:24 · 171 阅读 · 0 评论 -
UVA 10313 Pay the Price (完全背包问题+读入技巧+细节)*
题目链接:https://cn.vjudge.net/problem/UVA-10313#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define read(x,y) sca...原创 2018-09-26 00:02:23 · 243 阅读 · 0 评论 -
UVA - 674 Coin Change(完全背包水题)
题目链接:https://cn.vjudge.net/contest/255547#problem/B#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define read(x...原创 2018-09-20 19:51:07 · 144 阅读 · 0 评论 -
UVA 11367 Full Tank? (Dijkstra 变种)
题目链接:https://cn.vjudge.net/problem/UVA-11367#include<bits/stdc++.h>//#include<iostream>//#include<queue>//#include<cstring>//#include<cstdio>using namespace std;...原创 2018-10-09 22:27:17 · 218 阅读 · 0 评论 -
UVA 11137 Ingenuous Cubrency (背包水题)
题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2078#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#...原创 2018-09-25 00:11:24 · 166 阅读 · 0 评论 -
UVA 11426 Gcd Extreme III ()莫比乌斯反演水题)
题目链接:https://cn.vjudge.net/problem/UVA-11426#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define read(x,y) sca...原创 2018-09-14 08:34:12 · 180 阅读 · 0 评论 -
UVA 10404 Bachet's Game (简单博弈DP+背包)
题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1345#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#...原创 2018-09-23 23:35:34 · 234 阅读 · 0 评论 -
UVA 10465 Homer Simpson (完全背包)
题目链接:https://cn.vjudge.net/contest/255927#problem/G#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define read(x...原创 2018-09-23 21:52:31 · 276 阅读 · 0 评论 -
UVA 11076 Add Again (简单组合知识)
题目链接:https://cn.vjudge.net/problem/UVA-11076#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define read(x,y) scan...原创 2018-09-18 23:34:38 · 246 阅读 · 0 评论 -
UVA 1569 Multiple (最短路+同余性质约束)
题目链接:https://cn.vjudge.net/problem/UVA-1569#include<bits/stdc++.h>#pragma comment(linker,"/STACK:1024000000,1024000000")using namespace std;#define debug puts("YES");#define rep(x,y,z) fo...原创 2018-09-07 11:07:21 · 174 阅读 · 0 评论 -
UVA 10798 Be wary of Roses (BFS+几何状态对称)*
题目链接:https://cn.vjudge.net/problem/UVA-10798#include<bits/stdc++.h>#pragma comment(linker,"/STACK:1024000000,1024000000")using namespace std;#define debug puts("YES");#define rep(x,y,z) ...原创 2018-09-08 06:28:51 · 248 阅读 · 0 评论 -
UVA 147 Dollars (完全背包)
题目链接:https://cn.vjudge.net/problem/UVA-147#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define read(x,y) scanf...原创 2018-09-20 20:30:08 · 254 阅读 · 0 评论 -
UVA 1406 A Sequence of Numbers (树状数组+位权思维)*
题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4152#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#...原创 2018-10-11 22:50:13 · 360 阅读 · 0 评论 -
UVA 10479 The Hendrie Sequence (规律+递归)
题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1420#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#...原创 2018-11-15 19:52:52 · 171 阅读 · 0 评论 -
UVA 1510 Neon Sign (计数+思维)*
题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4256#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#...原创 2018-10-27 20:30:38 · 165 阅读 · 0 评论 -
UVA 294 Divisors (水)
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define lrt int l,int r,int rt#define lson l...原创 2018-10-30 17:29:25 · 127 阅读 · 0 评论 -
HDU 6415 K-Multiple Free set (容斥定理)*
题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2203#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#...原创 2018-10-30 15:41:51 · 184 阅读 · 0 评论 -
UVA 10542 Hyper-drive (容斥定理+规律)*
题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1483#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#...原创 2018-10-27 15:25:45 · 153 阅读 · 0 评论 -
UVA 11481 Arrange the Numbers (简单容斥)
#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define ll long long#define lrt int l,int r,int rt#define lson l...原创 2018-10-31 11:52:56 · 161 阅读 · 0 评论 -
UVA 11280 Flying to Fredericton (Dijkstra变种)
题目链接:https://cn.vjudge.net/problem/UVA-11280#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define read(x,y) sca...原创 2018-10-10 00:38:39 · 144 阅读 · 0 评论 -
uva 10280 Old Wine Into New Bottles(完全背包+剪枝)*
题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1221#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#...原创 2018-09-29 15:13:03 · 224 阅读 · 0 评论 -
UVA 10306 e-Coins (二维背包)
题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1247#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#...原创 2018-09-29 07:54:12 · 162 阅读 · 0 评论 -
UVA 12050 Palindrome Numbers (规律题)*
题目链接:https://cn.vjudge.net/problem/UVA-12050#include<bits/stdc++.h>using namespace std;#define debug puts("YES");#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)#define read(x,y) sca...原创 2018-09-21 21:16:14 · 213 阅读 · 0 评论 -
UVA 10325 The Lottery (容斥原理)
The Sports Association of Bangladesh is in great problem with their latest lottery ‘Jodi laiga Jai’. There are so many participants this time that they cannot manage all the numbers. In an urgent meet...原创 2018-08-17 08:08:09 · 227 阅读 · 0 评论 -
UVA 11806 Cheerleaders(容斥定理)
In most professional sporting events, cheerleaders play a major role in entertaining the spectators. Their roles are substantial during breaks and prior to start of play. The world cup soccer is no ex...原创 2018-08-17 07:33:39 · 191 阅读 · 0 评论 -
UVA 1635 无关的元素(杨辉三角+唯一分解性定理)
Young cryptoanalyst Georgie is investigating different schemes of generating random integer numbers ranging from 0 to m−1. He thinks that standard random number generators are not good enough, so he ha...原创 2018-07-26 11:16:16 · 326 阅读 · 0 评论 -
UVA 580 危险的组合 (组合计数)*
During the early stages of the Manhattan Project, the dangers of the new radioctive materials were not widely known. Vast new factory cities were built to manufacture uranium and plu- tonium in bulk. ...原创 2018-07-29 10:34:27 · 449 阅读 · 0 评论 -
UVA 1625 Color Length (计数DP+DP预处理+思维)
Cars painted in different colors are moving in a row on the road as shown in Figure 1. The color of each car is represented by a single character and the distance of two adjacent cars is assumed to be ...原创 2018-07-07 16:56:13 · 152 阅读 · 0 评论 -
UVA 12716 GCD XOR (素数筛法思想+打表规律)
Given an integer N, nd how many pairs (A; B) are there such that: gcd(A; B) = A xor B where1 B A N.Here gcd(A; B) means the greatest common divisor of the numbers A and B. And A xor B is thev...原创 2018-07-24 23:50:47 · 216 阅读 · 0 评论 -
UVA 1152 和为0的四个值 (二分+中途相遇)
The SUM problem can be formulated as follows: given four lists A,B,C,D of integer values, compute how many quadruplet (a,b,c,d) ∈ A×B×C×D are such that a+b+c+d = 0. In the following, we assume that al...原创 2018-07-06 07:03:34 · 176 阅读 · 0 评论 -
UVA 10791 最小公倍数的最小和(唯一分解性定理)
LCM (Least Common Multiple) of a set of integers is defined as the minimum number, which is a multiple of all integers of that set. It is interesting to note that any positive integer can be expressed ...原创 2018-07-23 22:22:58 · 567 阅读 · 0 评论 -
UVA 1471 Defense Lines (高效算法分析序列性质)*
After the last war devastated your country, you - as the king of the land of Ardenia - decided it was high time to improve the defense of your capital city. A part of your fortification is a line of ma...原创 2018-07-18 07:44:14 · 181 阅读 · 0 评论 -
UVA 120 Stacks of Flapjacks(算法设计技巧)
Stacks and Queues are often considered the bread and butter of data structures and find use in architecture, parsing, operating systems, and discrete event simulation. Stacks are also important in the...原创 2018-06-29 09:44:49 · 124 阅读 · 0 评论