T2还是模拟 枚举一下第一个放哪里 然后贪心的反转即可 虽然我也不会证,但是这题肯定有解qwq #include <cstdio> #include <algorithm> #include <cstring> using namespace std; ],midpath[],midans; int main(){ scanf("%d %d",&n,&k); ;i<=k+;i++){ int l=i,r=k+i; midans=…
暴力模拟即可 就是情况略多 #include <cstdio> #include <algorithm> #include <cstring> using namespace std; ],pos,ans=; int main(){ scanf("%d %d %d",&n,&a,&b); ;i<=n;i++) scanf("%d",&num[i]); ==){ pos=n/+; ) ans+=…
A. Optimal Currency ExchangeAndrew was very excited to participate in Olympiad of Metropolises. Days flew by quickly, and Andrew is already at the airport, ready to go home. He has n rubles left, and would like to exchange them to euro and dollar bil…
Codeforces Round #549 (Div. 2) B. Nirvana [题目描述] B. Nirvana time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Kurt reaches nirvana when he finds the product of all the digits of some positive int…
Interesting drink 题目链接: http://codeforces.com/contest/706/problem/B Description Vasiliy likes to rest after a hard work, so you may often meet him in some bar nearby. As all programmers do, he loves the famous drink "Beecola", which can be bough…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 翻转一次最多影响2k+1个地方. 如果n<=k+1 那么放在1的位置就ok.因为能覆盖1..k+1 如果n<=2k+1 那么就放在1+k的位置就ok.能覆盖1..2k+1 其他情况 考虑temp=n%(2k+1)的值. 如果temp==0 那么美滋滋.直接操作n/(2k+1)次就ok, 分别在1+k,1+k+2k+1,1+k+2k+1+2k+1.... 刚好占据n个位置. 如果k+1<=temp<=2k 那么我们可…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] i从1..n/2循环一波. 保证a[i]和a[n-i+1]就好. 如果都是2的话填上min(a,b)*2就好 其他情况跟随非2的. [代码] #include <bits/stdc++.h> #define LL long long #define rep1(i,a,b) for (int i = a;i <= b;i++) #define rep2(i,a,b) for (int i = a;i >= b;i--…
https://codeforces.com/contest/1040/problem/D 用法 mt19937 g(种子); //种子:time(0) mt19937_64 g(); //long long ll x=g(); //调用 代码 #include<bits/stdc++.h> #define ll long long #define P 23 using namespace std; ll n,l,r,k; char s[5]; ll mu=1; mt19937_64 g(ti…
D. Jury Meeting time limit per test 1 second memory limit per test 512 megabytes input standard input output standard output Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet toge…
A. Fraction 题目链接:http://codeforces.com/contest/854/problem/A 题目意思:给出一个数n,求两个数a+b=n,且a/b不可约分,如果存在多组满足条件的a和b,输出a/b最大的a和b. 题目思路:首先a+b=n,那么暴力枚举i和n-i,且gcd(i,n-i)==1,由于i越大是n-i越小,则a/b的值越大. 代码: //Author: xiaowuga #include <bits/stdc++.h> using namespace std…