Codeforces Round #441 (Div. 2)【A、B、C、D】
Codeforces Round #441 (Div. 2)
codeforces 876 A. Trip For Meal(水题)
题意:R、O、E三点互连,给出任意两点间距离,你在R点,每次只能去相邻点,要走过n个点,求走过的最短距离。
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main() {
int n, a, b, c;
scanf("%d%d%d%d", &n, &a, &b, &c);
if(n==) puts("");
else printf("%d\n", (n-) * min(a, min(b,c)) + min(a,b));
return ;
}
30ms
codeforces 876 B. Divisiblity of Differences(水题)
题意:有N个数,要从中选出K个,要求选出的数相减后都能整除m,求能都选出K个数,并输出选出的数。
题解:容易发现选出的数一定是 对m取余相同 的一类数,将每类数存起来,大于K个则输出这一类。
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
const int N = ;
int a[N];
vector<int>c[N];
int main() {
int n, k, m, i, j, f = ;
for(i = ; i < N; ++i) c[i].clear();
scanf("%d%d%d", &n, &k, &m);
for(i = ; i <= n; ++i) {
scanf("%d", &a[i]);
c[a[i]%m].push_back(i);
}
for(i = ; i < m; ++i) {
if(c[i].size() >= k) {
puts("Yes"); f = ;
for(j = ; j < k-; ++j) printf("%d ", a[c[i][j]]);
printf("%d\n", a[c[i][k-]]);
break;
}
}
if(!f) puts("No");
return ;
}
61ms
codeforces 875 A. Classroom Watch(暴力)
题意:给你n要求有几个x满足 x加上x的各个数位之和等于n,比如:x=100a+10b+c,n=x+a+b+c。
题解:暴力,枚举i(各个数位之和),令x=n-i再检验x是否满足题意。
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int a[];
int main() {
int n, i, j, x, y, cnt = ;
scanf("%d", &n);
for(i = min(n-,); i >= ; --i) {
x = n - i; y = ;
while(x) {y += x%; x /= ;}
if(y == i) a[cnt++] = n-i;
}
printf("%d\n", cnt);
for(i = ; i < cnt; ++i) printf("%d\n", a[i]);
return ;
}
15ms
codeforces 875 B. Sorting the Coins(模拟)
题意:一排n个位置,每次操作在p[i]位置放硬币,从左往右看,如果第i个位置有硬币,第i+1位置没有,则交换硬币(可以看看题目Note就好懂了,X0X0->0X0X是换了两次硬币,但这是一步,从左往右看一次是一步),直到无法再交换位置,求每次操作要几步。
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int N = ;
int a[N];
int main() {
int n, i, x;
scanf("%d", &n);
int m = n + ;
printf("");
for(i = ; i <= n; ++i) {
scanf("%d", &x);
a[x] = ;
while(a[m-]) m--;
printf(" %d", i-n+m);
}
return ;
}
155ms
不补题了,看不透英语。。。
Codeforces Round #441 (Div. 2)【A、B、C、D】的更多相关文章
- Codeforces Round #441 (Div. 2)
Codeforces Round #441 (Div. 2) A. Trip For Meal 题目描述:给出\(3\)个点,以及任意两个点之间的距离,求从\(1\)个点出发,再走\(n-1\)个点的 ...
- Codeforces Round #443 (Div. 2) 【A、B、C、D】
Codeforces Round #443 (Div. 2) codeforces 879 A. Borya's Diagnosis[水题] #include<cstdio> #inclu ...
- Codeforces Round #434 (Div. 2)【A、B、C、D】
Codeforces Round #434 (Div. 2) codeforces 858A. k-rounding[水] 题意:已知n和k,求n的最小倍数x,要求x后缀至少有k个0. 题解:答案就是 ...
- Codeforces Round #436 (Div. 2)【A、B、C、D、E】
Codeforces Round #436 (Div. 2) 敲出一身冷汗...感觉自己宛如智障:( codeforces 864 A. Fair Game[水] 题意:已知n为偶数,有n张卡片,每张 ...
- Codeforces Round #435 (Div. 2)【A、B、C、D】
//在我对着D题发呆的时候,柴神秒掉了D题并说:这个D感觉比C题简单呀!,,我:[哭.jpg](逃 Codeforces Round #435 (Div. 2) codeforces 862 A. M ...
- Codeforces Round #440 (Div. 2)【A、B、C、E】
Codeforces Round #440 (Div. 2) codeforces 870 A. Search for Pretty Integers(水题) 题意:给两个数组,求一个最小的数包含两个 ...
- Codeforces Round #439 (Div. 2)【A、B、C、E】
Codeforces Round #439 (Div. 2) codeforces 869 A. The Artful Expedient 看不透( #include<cstdio> in ...
- [日常] Codeforces Round #441 Div.2 实况
上次打了一发 Round #440 Div.2 结果被垃圾交互器卡掉 $200$ Rating后心情复杂... 然后立了个 Round #441 要翻上蓝的flag QAQ 晚饭回来就开始搞事情, 大 ...
- Codeforces Round #430 (Div. 2) 【A、B、C、D题】
[感谢牛老板对D题的指点OTZ] codeforces 842 A. Kirill And The Game[暴力] 给定a的范围[l,r],b的范围[x,y],问是否存在a/b等于k.直接暴力判断即 ...
随机推荐
- 在IIs上部署asp.net core2.1项目
转自:https://www.cnblogs.com/jasonduan/p/9193702.html 在IIS上部署你的ASP.NET Core 2.1项目 1.在控制面板→程序→启用或关闭Wi ...
- 三:Bootstrap-js插件
模式框: <button class="btn btn-default btn-lg" data-toggle="modal" data-target=& ...
- jenkins 参数化构建过程
构建项目时我们可能需要切换到另一个分支编译,或者说每次编译版本都要加1,这时候我们可以改配置或者改脚本文件,这显然不是一个好的方式,那么如何能在编译前让用户输入参数呢?jenkins早就为我们考虑好 ...
- Fill Table Row(it’s an IQ test question)
Here is a table include the 2 rows. And the cells in the first row have been filled with 0~4. Now yo ...
- Jquery获取radio选中的值
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- C# Time Class using MySQL
http://www.csharphelp.com/2007/09/c-time-class/ /* datatypes. Time class is writen in C# and .NET 2. ...
- BZOJ4568: [Scoi2016]幸运数字(线性基 倍增)
题意 题目链接 Sol 线性基是可以合并的 倍增维护一下 然后就做完了?? 喵喵喵? // luogu-judger-enable-o2 #include<bits/stdc++.h> # ...
- BZOJ4011: [HNOI2015]落忆枫音(dp 乘法原理)
题意 题目链接 Sol 非常妙的一道题 设\(inder[i]\)表示\(i\)号节点的度数 首先如果是个DAG的话,可以考虑在每个点的入边中选一条边作为树形图上的边,这样\(ans = \prod_ ...
- Python之装饰器复习
一.什么是装饰器? 装饰器他人的器具,本身可以是任意可调用对象,被装饰者也可以是任意可调用对象. 二.强调装饰器的原则: 1 不修改被装饰对象的源代码 2 不修改被装饰对象的调用方式 3:在遵循1和2 ...
- Same Tree 比较两个二叉树是否完全相同
Given two binary trees, write a function to check if they are equal or not. Two binary trees are con ...