链接: https://codeforces.com/contest/1269/problem/D 题意: You are given a Young diagram. Given diagram is a histogram with n columns of lengths a1,a2,-,an (a1≥a2≥-≥an≥1). Young diagram for a=[3,2,2,2,1]. Your goal is to find the largest number of non-ove…
Codeforces Round #609 (Div. 2)前五题题解 补题补题…… C题写挂了好几个次,最后一题看了好久题解才懂……我太迟钝了…… 然后因为longlong调了半个小时…… A.Equation 题目大意:有一个数字n,让你给出任意两个合数a,b满足a - b = n. 我们知道大于2的偶数都是合数,那么如果n为奇数,只要n加上一个奇数合数一定也为合数,如果n为偶数,那么n加上一个偶数合数也一定为合数. 因为只求任意一组,就直接选择4,9,若为奇数输出 +n 和9,偶数输出 +…
contest链接:https://codeforces.com/contest/1269 A. Equation 题意:输入一个整数,找到一个a,一个b,使得a-b=n,切a,b都是合数 思路:合数非常多,从1开始枚举b,a就是b+n,每次check一下a,b是否是合数,是的话直接输出,break即可 AC代码: #include<iostream> #include<string> #include<vector> #include<cstring> #…
Equation Modulo Equality Long Beautiful Integer Domino for Young K Integers Equation \[ Time Limit: 3 s\quad Memory Limit: 256 MB \] 这题做法很多,甚至可以直接暴力判断 view #include <map> #include <set> #include <list> #include <ctime> #include <…
链接: https://codeforces.com/contest/1269/problem/C 题意: You are given an integer x of n digits a1,a2,-,an, which make up its decimal notation in order from left to right. Also, you are given a positive integer k<n. Let's call integer b1,b2,-,bm beautif…
A题 给出n,求大于n的两个合数a和b,并且a-b = n 直接输出n的倍数即可 int n; int main() { cin >> n; cout << 9*n << ' ' << 8*n << endl; return 0; } B题 给出n和k两个数,给出两个数组a和b,求一个数x让a数组的每个数加上x对k取余等于b数组的数,可以进行重排序 给a和b排序,排完序再交错求x验证,求最下的x ll a[2010],b[2010],c[2010…
签到,乘以两个相邻的合数 #include<bits/stdc++.h> using namespace std; int main(int argc, char const *argv[]) { long long n; cin>>n; cout<<9*n<<" "<<8*n<<endl; return 0; } 链接 这里的加数取模相当于移位,把两个序列排序后,遍历移位对应情况就可以. #include <…
题意:给一个n<=1e7,找两个合数a和b使得a-b的差为n. 构造a=3n,b=2n,必含有公因子n,只有当n是1的时候是特例. #include<bits/stdc++.h> using namespace std; #define int long long #define inf 0x3f3f3f3f3f3f #define N 300009 ,,,,}; signed main(){ int n;scanf("%lld",&n); ){ cout&l…
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate it n = int(raw_input()) s = "" a = ["I hate that ","I love that ", "I hate it","I love it"] for i in ran…
Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/output 1 s, 256 MB    x3384 B Pyramid of Glasses standard input/output 1 s, 256 MB    x1462 C Vasya and String standard input/output 1 s, 256 MB    x1393…