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】的更多相关文章

  1. Codeforces Round #441 (Div. 2)

    Codeforces Round #441 (Div. 2) A. Trip For Meal 题目描述:给出\(3\)个点,以及任意两个点之间的距离,求从\(1\)个点出发,再走\(n-1\)个点的 ...

  2. Codeforces Round #443 (Div. 2) 【A、B、C、D】

    Codeforces Round #443 (Div. 2) codeforces 879 A. Borya's Diagnosis[水题] #include<cstdio> #inclu ...

  3. 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. 题解:答案就是 ...

  4. Codeforces Round #436 (Div. 2)【A、B、C、D、E】

    Codeforces Round #436 (Div. 2) 敲出一身冷汗...感觉自己宛如智障:( codeforces 864 A. Fair Game[水] 题意:已知n为偶数,有n张卡片,每张 ...

  5. Codeforces Round #435 (Div. 2)【A、B、C、D】

    //在我对着D题发呆的时候,柴神秒掉了D题并说:这个D感觉比C题简单呀!,,我:[哭.jpg](逃 Codeforces Round #435 (Div. 2) codeforces 862 A. M ...

  6. Codeforces Round #440 (Div. 2)【A、B、C、E】

    Codeforces Round #440 (Div. 2) codeforces 870 A. Search for Pretty Integers(水题) 题意:给两个数组,求一个最小的数包含两个 ...

  7. Codeforces Round #439 (Div. 2)【A、B、C、E】

    Codeforces Round #439 (Div. 2) codeforces 869 A. The Artful Expedient 看不透( #include<cstdio> in ...

  8. [日常] Codeforces Round #441 Div.2 实况

    上次打了一发 Round #440 Div.2 结果被垃圾交互器卡掉 $200$ Rating后心情复杂... 然后立了个 Round #441 要翻上蓝的flag QAQ 晚饭回来就开始搞事情, 大 ...

  9. 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.直接暴力判断即 ...

随机推荐

  1. xcopy命令的其他参数

    xcopy /s /e /h "c:\123" "D:\123\" 后面多一个斜杠,让程序知道是目录 以下还给您提供了 xcopy 命令的其他参数: /A 仅复 ...

  2. html制作chm格式开源文档

    在主界面点击生成器,找到网页所在的文件夹. 然后用编译,还是找到网页文件夹.根据需要设置.TOC 那一项是目录,请根据需要修改. 特别要注意的是,预设那里,点击那个配置图标,会打开如下图的预设编辑器. ...

  3. 基于asp.net mvc的近乎产品开发培训课程(第一讲)

    演示产品源码下载地址:http://www.jinhusns.com/Products/Download 

  4. nodejs的gridfs基本操作

    var mongoose = require('mongoose'); var Schema = mongoose.Schema; mongoose.connect('mongodb://127.0. ...

  5. 撩课-Python-每天5道面试题-第3天

    一. 代码实现: 计算1到100之间, 所有的奇数之和 result = , ): result += i print(result) 二. 代码实现: 接收用户输入数字, 求出从0至这个数字的累加和 ...

  6. 工厂方法模式(GOF23)

    耦合关系直接决定着软件面对变化时的行为 主要对模块之间的关系进行整理,依赖关系倒置(依赖反转),变化快的东西不能影响到变化慢的东西 用封装机制来隔离易变的对象,抽象部分(不易变)和细节部分(可能容易变 ...

  7. idea 常用快捷键 笔记

    1. main方法 输入psv tab或回车 类似的 psf fori (for循环) sout 备注:  通过ctrl+j 可以查询 2. 删除当前行 ctrl + y 3. 复制当前行 ctrl ...

  8. BZOJ1812: [Ioi2005]riv(树形dp)

    题意 题目链接 Sol 首先一个很显然的思路是直接用\(f[i][j] / g[i][j]\)表示\(i\)的子树中选了\(j\)个节点,该节点是否选的最小权值.但是直接这样然后按照树形背包的套路转移 ...

  9. ionic--分模块

    1. app.js var app=angular.module("myApp",["ionic","myController"," ...

  10. Raspberry Pi - Huawei HiLink E3256 3G modem to ethernet adapter

    Raspberry Pi - Huawei HiLink E3256 3G modem to ethernet adapter This page documents how to configure ...