CF870A Search for Pretty Integers】的更多相关文章

CF870A Search for Pretty Integers 题意翻译 给出两个整数n,m,a数组有n个数,b数组有m个数.求一个数,这个数的每一位必须在a数组和b数组中至少出现过一次,求符合条件的数当中最小的数. Translated by @我是lyy 题目描述 You are given two lists of non-zero digits. Let's call an integer pretty if its (base 1010 ) representation has a…
A. Search for Pretty Integers [题目链接]:http://codeforces.com/contest/872/problem/A 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 in…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 先枚举一个数字的情况. 再枚举两个数的情况就好. [代码] #include <bits/stdc++.h> #define ll long long using namespace std; const int N = 20; int a[N],b[N],n,m; int main() { //freopen("F:\\rush.txt","r",stdin); scanf("…
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…
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(…
A. Search for Pretty Integers: 题目传送门 题目大意:给定N和M个数,从前一个数列和后一个数列中各取一个数,求最小值,相同算一位数. 一道水题,读入A.B数组后枚举i.j判断最小值即可,注意相同时只需要一位. B. Maximum of Maximums of Minimums: 题目传送门 题目大意:给定N和K,表示一个有N个数的数列和可以分成K段,使每一段中的最小值最大. 分类讨论,有三种情况: ·K=1,取最小值. ·K=2,分成两段取两段最小值的最大值. ·…
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…
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted in ascending from left to right. Integers in each column are sorted in ascending from top to bottom.…
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted from left to right. The first integer of each row is greater than the last integer of the previous ro…