![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
codeforces
TriAzure
靡不有初,鲜克有终。
展开
-
Almost Identity Permutations | 错排 | 数学
读题的时候要仔细一点,n个数字,问在有至少(n-k)个数字序号与值对应的情况下,有多少种不同的排列。换言之就是有n个数字,求从k到1的错排(前面再乘一个组合数)。要注意是至少……所以后面对k讨论的时候每种情况都是+。 这里涉及到一个全错位排列的知识点,也就是所有的数字都不在原来的位置。 比较小的几个错排数: D1= 0,D2= 1,D3=2,D4= 9,D5= 44,D6= 265,D7= 185...原创 2019-11-15 09:28:17 · 383 阅读 · 0 评论 -
D. Treasure Island | 搜索
题意:给你一个n x m的矩阵,其中’.‘可达,’#‘表示障碍。每次只能向右或者向下走,问至少添加多少个’#’,能够使得自(0, 0)走不到(n-1, m-1)。 一开始这题把我吓住了,觉得是不是要搞出所有可行的通路,然后找出重合的公共点,把这一点堵死。但其实不用这么麻烦,因为题目规定了移动方向只能是向下或者向右,所以答案只会是0,1,2三者其中之一。 但是想出这一点之后,还是存在问题,即使(0,...原创 2019-09-10 16:02:42 · 244 阅读 · 0 评论 -
Optimal Currency Exchange | 思维 | 水题
题意:小明有n个卢布,1美元可换d卢布,1欧元可换e卢布。但是,美元、欧元各有其币值。现在问你,小明如何换钱,可以使得最后手中剩余的卢布最少? 首先要理清一个问题,那就是,币值在这题里并没有意义。因为你用200的换,和用200张面值为1的换,结果是一样的。这题我们要做的是让剩下的卢布最少,而不是要让转换后的钱最少。 搞清楚这一点,就可以想明白我们的策略了,既然是要让原本货币剩余最少,那肯定是尽可能...原创 2019-09-05 18:21:58 · 378 阅读 · 0 评论 -
Codeforces educational round #67 div 2
A #include <bits/stdc++.h> using namespace std; #define endl '\n' #define ll long long int T; ll n, s, t; int main() { cin >> T; while(T) { cin >> n >> ...原创 2019-07-04 19:52:46 · 77 阅读 · 0 评论 -
Codeforces Round #567 div2
A 分类讨论分类太乱,漏了给了钱还是买不了的情况。 WA #include <iostream> #include <algorithm> #include <cmath> using namespace std; int main() { long long x, y, z; cin >> x >> y >>...原创 2019-06-19 18:28:45 · 97 阅读 · 0 评论 -
2019.4.24 Codeforces Round #554 (Div. 2)
A题比较简单,B题不知道为什么死循环,查了好多遍查不出来,十二点多的时候实在太困了就睡了。今天补题。 A #include <iostream> using namespace std; int n, // chest num m, // key num chesteven, // chest中偶数的个数 ch...原创 2019-04-25 17:49:42 · 309 阅读 · 0 评论 -
Codeforces Round #555 (Div. 3)
A 读题没度清楚,搞了个checkset[0]在里面,做的时候循环一直有问题,检查好久才发现 #include <iostream> #include <set> using namespace std; int checkset[10] = {0}; int main() { int n; cin >> n; set<int&g...原创 2019-04-28 08:42:46 · 86 阅读 · 0 评论 -
Codeforces #Round 522(div 3)
A. Restoring Three Numbers ** time limit - per test 1 second memory limit - per test 256 megabytes input - standard input output - standard output** Polycarp has guessed three positive integers a, b ...原创 2019-04-17 19:45:50 · 211 阅读 · 0 评论