Mujin Programming Challenge 2017题解】的更多相关文章

传送门 \(A\) 似乎并不难啊然而还是没想出来-- 首先我们发现对于一个数\(k\),它能第一个走到当且仅当对于每一个\(i<k\)满足\(x_i\geq 2i-1\),这样我们就可以把所有的\(i\)移到\(2i-1\)然后让\(k\)直接一路过去了.而如果对于每个\(k\)都有这个性质,答案就是\(n!\) 所以从左往右扫,记录当前栈中的元素个数,设当前的\(k\)在栈中的第\(i\)个位置,且\(k\)不满足\(x_k\geq 2i-1\),那么我们必须把前\(i\)个数中移出至少一个才…
Mujin Programming Challenge 2017 A - Robot Racing 如果每个数都是一个一个间隔开的,那么答案是\(n!\) 考虑把一个数挪到1,第二个数挪到3,以此类推,如果不行,证明前面中有个数肯定会被选择,所以任意选一个数到终点,继续这样的操作 最后剩下的乘一个阶乘即可 #include <bits/stdc++.h> #define fi first #define se second #define pii pair<int,int> #de…
题目大意 有一个\(n\)个点\(m\)条边的简单无向连通图,初始为白色,可以执行操作让一些边变黑,要求使得操作后的图不存在黑色的奇环,且不能使得其他的任何变黑而还符合要求.问最后有多少可能结果.\(n\leqslant 21\),\(n-1\leqslant m\leqslant \dfrac{n(n-1)}2\)(原题中\(n\leqslant 16\)) 题解 因为不存在黑色的奇环,那么最后的黑边组成的图一定可以黑白染色,所以一定是一张二分图.又因为若最后黑图不连通,在两个环之间连一条边不…
题意: 给你n个人的位置,每个人能往后跳一格或两格到无人的位置,跳到0位置,这个人消失,n个人消失组成一个排列,问有多少种排列. 思路: 额,搞了一整场这个A...代码也巨挫了. 处理成1,3,5,7,9.....的位置情况,当出现连续的时候,比如1,3,5,7,8的话那么后面的数怎么跳都不会在前面这些数之前跳出去,bingo! 所以当前就可以说明这几个就可以在现在跳出去,比如1,3,5,7,8这5个数,第一次跳出去的数有5种情况,然而一个跳出去以后,接下来一个位置是7这个位置. 代码num表示…
C.Cheering To boost contestants' performances in the 20th La Salle - Pui Ching Programming Challenge, the organizers have bought N robots to cheer for them. Each robot is supposed to display cheering slogans, letter by letter. Unfortunately, due to s…
NAIPC 2017 Yin and Yang Stones 75.39% 1000ms 262144K   A mysterious circular arrangement of black stones and white stones has appeared. Ming has been tasked with balancing the stones so that only one black and one white stone remain. Ming has two ope…
ACM International Collegiate Programming Contest, Tishreen Collegiate Programming Contest (2017)- K. Poor Ramzi -dp+记忆化搜索 [Problem Description] 给你一串\(01\)字符串,将其划分,使得划分后,分别求出每组\(01\)之和后是回文的,求划分的方案数, [Solution] 定义\(dp[l][r]\)表示,区间\([l,r]\)中满足条件的方案数是多少.…
M-SOLUTIONS Programming Contest 2020 题解 目录 M-SOLUTIONS Programming Contest 2020 题解 A - Kyu in AtCoder B - Magic 2 C - Marks D - Road to Millionaire E - M's Solution F - Air Safety 题目质量好高啊,做完感觉好难涨智商了诶.(除了某一道程序又臭又长的F) A - Kyu in AtCoder 我们可以放很多个if来判断,但…
D.Distribution of Days The Gregorian calendar is internationally the most widely used civil calendar. It is named after Pope Gregory XIII, who introduced it in October 1582. In the Gregorian calendar, there are 28 days in February in a common year an…
A. Ambiguous Dates There are two popular formats for representing a date: day/month/year or month/day/year. For example, today can be represented as 15/8/2017 or 8/15/2017. Sometimes (like on today), using one way or another should pose no confusion…