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…
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the olympiad should meet together in Metropolis (the capital of the country) for the problem preparation process. There are n + 1 cities consecutively num…
Helen works in Metropolis airport. She is responsible for creating a departure schedule. There are n flights that must depart today, the i-th of them is planned to depart at the i-th minute of the day. Metropolis airport is the main transport hub of…
Maxim wants to buy an apartment in a new house at Line Avenue of Metropolis. The house has n apartments that are numbered from 1 to nand are arranged in a row. Two apartments are adjacent if their indices differ by 1. Some of the apartments can alrea…
Petya is a big fan of mathematics, especially its part related to fractions. Recently he learned that a fraction  is called proper iff its numerator is smaller than its denominator (a < b) and that the fraction is called irreducible if its numerator…
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…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 翻转一次最多影响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--…
地址:http://codeforces.com/contest/782/problem/B 题目: B. The Meeting Place Cannot Be Changed time limit per test 5 seconds memory limit per test 256 megabytes input standard input output standard output The main road in Bytecity is a straight line from…