C. Maximum splitting time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given several queries. In the i-th query you are given a single positive integer ni. You are to represent ni as…
B. Maximum of Maximums of Minimums time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given an array a1, a2, ..., an consisting of n integers, and an integer k. You have to split the a…
Codeforces Round #440 (Div. 2) codeforces 870 A. Search for Pretty Integers(水题) 题意:给两个数组,求一个最小的数包含两个数组各至少一个数. #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int n, m; ], b[]; int main() { , y = , s = ; scanf(…
地址: 题目: C. Maximum splitting time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given several queries. In the i-th query you are given a single positive integer ni. You are to represe…
A. Search for Pretty Integers time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given two lists of non-zero digits. Let's call an integer pretty if its (base 10) representation has at…
A. Search for Pretty Integers 题目链接:http://codeforces.com/contest/872/problem/A 题目意思:题目很简单,找到一个数,组成这个数的数字即在A数组中出现过,也在B数组中出现过,问这个数最小是多少. 题目思路:首先要么一个数两个数组都出现过直接输出来,要么分别取两个数组中最小的数组合一下输出. 代码: //Author: xiaowuga #include <bits/stdc++.h> using namespace st…
A. Search for Pretty Integers You are given two lists of non-zero digits. Let's call an integer pretty if its (base 10) representation has at least one digit from the first list and at least one digit from the second list. What is the smallest positi…
Problem  Codeforces Round #556 (Div. 2) - D. Three Religions Time Limit: 1000 mSec Problem Description Input Output Sample Input 51 2 1 2 1 Sample Output 1 1 1 2 2 题解:这个题有做慢了,这种题做慢了和没做出来区别不大... 读题的时候脑子里还意识到素数除了2都是奇数,读完之后就脑子里就只剩欧拉筛了,贪心地构造使得前缀和是连续的素数,那…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 肯定用尽量多的4最好. 然后对4取模的结果 为0,1,2,3分类讨论即可 [代码] #include <bits/stdc++.h> using namespace std; int fix(int x) { int t = x/4; int rest = x%4; if (rest==0) return t; if (rest==1) { if (t>=2) { t-=2; }else return -1; t++;…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] k=1的时候就是最小值, k=2的时候,暴力枚举分割点. k=3的时候,最大值肯定能被"独立出来",则直接输出最大值 [代码] #include <bits/stdc++.h> #define ll long long using namespace std; const int N = 1e5; int a[N+10],n,k,premi[N+10],aftermi[N+10]; int main() {…