CodeForces - 1245 C - Constanze's Machine】的更多相关文章

Codeforces Round #597 (Div. 2) Constanze is the smartest girl in her village but she has bad eyesight. One day, she was able to invent an incredible machine! When you pronounce letters, the machine will inscribe them onto a piece of paper. For exampl…
链接: https://codeforces.com/contest/1245/problem/C 题意: Constanze is the smartest girl in her village but she has bad eyesight. One day, she was able to invent an incredible machine! When you pronounce letters, the machine will inscribe them onto a pie…
C. Constanze's Machine Constanze is the smartest girl in her village but she has bad eyesight. One day, she was able to invent an incredible machine! When you pronounce letters, the machine will inscribe them onto a piece of paper. For example, if yo…
#include<bits/stdc++.h> using namespace std; ]; ]; ; int main() { dp[] = ; scanf(); ); ; i<=N; ++i) { if(s[i] == 'm' || s[i] == 'w') { puts("); ; } dp[i] = dp[i-]; &&(s[i] == ]==]=='u')) dp[i] = (dp[i-]+dp[i-])%MOD; } printf("%d…
Codeforces Round #597 (Div. 2) Let nn be a positive integer. Let a,b,ca,b,c be nonnegative integers such that a+b+c=na+b+c=n. Alice and Bob are gonna play rock-paper-scissors nn times. Alice knows the sequences of hands that Bob will play. However, A…
传送门 显然这个图是个 $DAG$ ,那么就可以考虑跑 $dp$ 了 先考虑没有梯子的情况,首先把每个位置标号,越后面的位置编号越小,终点位置编号为 $1$ 那么从终点往起点 $dp$ ,枚举当前位置摇到的数字,那么有 $f[x]=\frac{\sum_{i=1}^{6}(f[x-i]+1)}{6}$,并且 $f[1]=0$ 但是这是在 $x>6$ 的情况下成立的,因为如果 $x<=6$ 那么有可能不走,特殊考虑一下 首先 $f[2]$ ,那么有 $5/6$ 的概率原地不动,$1/6$ 的概率…
传送门 经典的最小生成树模型 建一个点 $0$ ,向所有其他点 $x$ 连一条边权为 $c[x]$ 的边,其他任意两点之间连边,边权为 $(k_i+k_j)(\left | x_i-x_j\right |+\left | y_i-y_j\right |)$ 然后用 $prim$ 求个最小生成树即可,然后考虑一下输出方案 多维护一个 $frm[x]$ 表示当前的 $dis[x]$ 是从哪个点贡献来的就行了 #include<iostream> #include<cstdio> #in…
A - Good ol' Numbers Coloring 题意:有无穷个格子,给定 \(a,b\) ,按以下规则染色: \(0\) 号格子白色:当 \(i\) 为正整数, \(i\) 号格子当 \(i\geq a\) 且 \(i-a\) 是白色格子时涂白色:当 \(i\) 为正整数, \(i\) 号格子当 \(i\geq b\) 且 \(i-b\) 是白色格子时涂白色:仍不是白色的涂黑色,问黑色格子是否有无穷个. 题解:好像做过很多次了,遍历所有的整数的充要条件是这些拿来线性组合的步长的gcd…
Machine Programming 题目连接: http://codeforces.com/problemset/problem/164/B Descriptionww.co One remarkable day company "X" received k machines. And they were not simple machines, they were mechanical programmers! This was the last unsuccessful ste…
E. Little Artem and Time Machine 题目连接: http://www.codeforces.com/contest/669/problem/E Description Little Artem has invented a time machine! He could go anywhere in time, but all his thoughts of course are with computer science. He wants to apply thi…