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…
链接: 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…
Hard problem 题目链接: http://codeforces.com/contest/706/problem/C Description Vasiliy is fond of solving different tasks. Today he found one he wasn't able to solve himself, so he asks you to help. Vasiliy is given n strings consisting of lowercase Engl…
A - Good ol' Numbers Coloring 题意:有无穷个格子,给定 \(a,b\) ,按以下规则染色: \(0\) 号格子白色:当 \(i\) 为正整数, \(i\) 号格子当 \(i\geq a\) 且 \(i-a\) 是白色格子时涂白色:当 \(i\) 为正整数, \(i\) 号格子当 \(i\geq b\) 且 \(i-b\) 是白色格子时涂白色:仍不是白色的涂黑色,问黑色格子是否有无穷个. 题解:好像做过很多次了,遍历所有的整数的充要条件是这些拿来线性组合的步长的gcd…
#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…
链接: https://codeforces.com/contest/1245/problem/D 题意: Shichikuji is the new resident deity of the South Black Snail Temple. Her first job is as follows: There are n new cities located in Prefecture X. Cities are numbered from 1 to n. City i is locate…
链接: https://codeforces.com/contest/1245/problem/B 题意: Let n be a positive integer. Let a,b,c be nonnegative integers such that a+b+c=n. Alice and Bob are gonna play rock-paper-scissors n times. Alice knows the sequences of hands that Bob will play. H…
链接: https://codeforces.com/contest/1245/problem/A 题意: Consider the set of all nonnegative integers: 0,1,2,-. Given two integers a and b (1≤a,b≤104). We paint all the numbers in increasing number first we paint 0, then we paint 1, then 2 and so on. Ea…
题目链接:https://codeforces.com/contest/1245/problem/D 题目大意: 平面上有n座城市,第i座城市的坐标是 \(x[i], y[i]\) , 你现在要给n城市供电,对于第i座城市,你可以选择两种方式给其供电: 建造一个发电站供电,这需要花费 \(c[i]\) : 连一条连向城市j的电缆,这需要花费 \((|x[i]-x[j]|+|y[i]-y[j]|) \times (k[i]+k[j])\) . 现在告诉你n以及 \(x[i], y[i], c[i]…
题:https://codeforces.com/contest/1245/problem/F 分析:转化为:求区间内满足a&b==0的对数(解释见代码) ///求满足a&b==0在区间[l,r]的对数 ///推导:区间[2l,2r]可由[l,r]乘3倍得来 ///原因:*2我们可以看成事左移1位,那么这个位置上,对于俩个数来说 /////////可以取0,1 或1,0或0,0才依然满足 a&b==0这个题目条件 /////////这个公式可以用递归推导回溯计算, ////////…