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];

int main() {
int n,k;
cin >> n >> k;
for(int i = 0; i < n; i++) cin >> a[i];
sort(a,a+n);
for(int i = 0; i < n; i++) cin >> b[i];
sort(b,b+n);
ll x,mini = k;
for(int i = 0; i < n; i++) {
int flag = 0;
x = (b[i] - a[0] + k) % k;
for(int j = 0; j < n; j++) {
int l = (j+i) % n;
if((b[l] - a[j] + k) % k != x) flag = 1;
}
if(!flag) mini = min(mini,x);
}
cout << mini << endl;
}

C题

给出一个数,让这个数的每隔k位的数都相等并且要大于等于原数的最小数

按照题意模拟一遍,判断一下是不是比原数大,比原数小的话就把从第k个数开始找一个小于9的数然后加一(找到小于9之前的数都变为0),最后再按照题意模拟一边,输出即可

int main() {
int n,k;
cin >> n >> k;
cin >> s;
strcpy(ss,s);
for(int i = 0; i < n; i++) s[i] = s[i%k];
if(strcmp(ss,s) <= 0) {
cout << n << endl << s << endl;
}
else {
int a = k-1;
while(ss[a] == '9') {
ss[a] = '0';
a--;
}
ss[a]++;
for(int i = 0; i < n; i++) ss[i] = ss[i%k];
cout << n << endl << ss << endl;
}
return 0;
}

D题

输入n 后面输入n个数 每个数代表那一列有多少个11的方块,为问最多可以用多少个12的方块覆盖

如果那一列是偶数,那就直接除以2,如果是奇数,如果隔壁列也是奇数,那么它们可以多构造一个,他们相间隔偶数列也是可以构造的。

int main() {
ll n,sum = 0,flag1 = 0,flag2 = 0,a;
cin >> n;
for(int i = 0; i < n; i++) {
cin >> a;
sum += a/2;
if(a&1) {
if(i % 2 == 0) flag1++;
else flag2++;
}
}
cout << (sum + min(flag1,flag2)) << endl;
return 0;
}

Codeforces Round #609 (Div. 2)的更多相关文章

  1. Codeforces Round #609 (Div. 2)前五题题解

    Codeforces Round #609 (Div. 2)前五题题解 补题补题…… C题写挂了好几个次,最后一题看了好久题解才懂……我太迟钝了…… 然后因为longlong调了半个小时…… A.Eq ...

  2. Codeforces Round #609 (Div. 2) D. Domino for Young

    链接: https://codeforces.com/contest/1269/problem/D 题意: You are given a Young diagram. Given diagram i ...

  3. Codeforces Round #609 (Div. 2) C. Long Beautiful Integer

    链接: https://codeforces.com/contest/1269/problem/C 题意: You are given an integer x of n digits a1,a2,- ...

  4. Codeforces Round #609 (Div. 2) A-E简要题解

    contest链接:https://codeforces.com/contest/1269 A. Equation 题意:输入一个整数,找到一个a,一个b,使得a-b=n,切a,b都是合数 思路:合数 ...

  5. Codeforces Round #609 (Div. 2) 题解

    Equation Modulo Equality Long Beautiful Integer Domino for Young K Integers Equation \[ Time Limit: ...

  6. Codeforces Round #609 (Div. 2) A到C题

    签到,乘以两个相邻的合数 #include<bits/stdc++.h> using namespace std; int main(int argc, char const *argv[ ...

  7. Codeforces Round #609 (Div. 2) 【A,B,C】

    题意:给一个n<=1e7,找两个合数a和b使得a-b的差为n. 构造a=3n,b=2n,必含有公因子n,只有当n是1的时候是特例. #include<bits/stdc++.h> u ...

  8. Codeforces Round #366 (Div. 2) ABC

    Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...

  9. Codeforces Round #354 (Div. 2) ABCD

    Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/out ...

随机推荐

  1. linux awk(gawk)

    awk的前世今生: awk名字的由来:分别取三个创始人Ah,Weiberger,Kernighan三个人的首字母. awk是一个报告生成器可以格式化输出文本内容.模式扫描和处理语言(pattern s ...

  2. day 23 面向对象中类的成员 和嵌套

    1.类的成员? 变量.方法.属性 class Foo: # 方法 def __init__(self,name): # 实例变量/字段 self.name = name # 方法 def func(s ...

  3. 如何理解Nginx, WSGI, Flask(Django)之间的关系

    如何理解Nginx, WSGI, Flask(Django)之间的关系 值得指出的是,WSGI 是一种协议,需要区分几个相近的名词: uwsgi 同 wsgi 一样也是一种协议,uWSGI服务器正是使 ...

  4. SpringBoot:带你认认真真梳理一遍自动装配原理

    前言 Spring翻译为中文是“春天”,的确,在某段时间内,它给Java开发人员带来过春天,但是随着我们项目规模的扩大,Spring需要配置的地方就越来越多,夸张点说,“配置两小时,Coding五分钟 ...

  5. IEnumerable和IEnumerator详解

    引言 IEnumerable是可枚举的所有非泛型集合的基接口, IEnumerable包含一个方法GetEnumerator(),该方法返回一个IEnumerator:IEnumerator提供通过C ...

  6. Windows Server 2012R2 DHCP服务介绍及搭建 转载

    转载链接:https://blog.csdn.net/KamRoseLee/article/details/79251830   一.什么是DHCP DHCP(DynamicHost Configur ...

  7. 2019年12月4日Linux开发手记

    OK,经过昨天对V4L2工作流程的学习,现在已经大体了解了V4L2的工作原理,现在开始对V4L2的API的学习,目标:1.打开摄像头 2.储存图像 3.关闭摄像头,API网址:Linux Media ...

  8. .Net Core使用分布式缓存Redis:基础

    一.前言 Redis的介绍网上很多不再赘述.本次环境为net core 2.2,使用的StackExchange.Redis来操作Redis. 二.引用Microsoft.Extensions.Cac ...

  9. 使用Feign访问接口

     添加主要依赖 使用Feign访问接口的配置,如果服务不在Eureka上,可以不加Eureka的依赖,用在FeignClient上指定url的方式访问 dependencies { compile(' ...

  10. Vue.js 控制css样式

    <script src="https://unpkg.com/vue/dist/vue.js"></script> <style type=" ...