#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std; int main()
{
int k, r, i;
scanf("%d %d", &k, &r); for(i = 1; i < 10000; ++i)
{
if((i*k)%10 == r)
break;
else if((i*k) % 10 == 0){
break;
}
} printf("%d\n", i);
return 0;
} #include <stdio.h>
#include <string.h>
#include <iostream> using namespace std; int main()
{
int n, k;
int ai[510]; scanf("%d %d", &n, &k);
int i;
for(i = 0; i < n; ++i)
scanf("%d", (ai+i)); int sum = 0;
for(i = 0; i < n-1; ++i)
{
int n_sum = ai[i] + ai[i+1];
if(n_sum < k)
{
sum += k - n_sum;
ai[i+1] += k - n_sum;
}
}
printf("%d\n", sum);
for(i = 0; i < n; ++i)
printf("%d ", ai[i]);
return 0;
} #include <stdio.h>
#include <iostream>
#include <algorithm>
using namespace std; int main()
{
long long ans[3] = {0}, an = 0;
long long m[3];
int tag = 0;
for(int i = 0; i < 3; ++i)
{
cin >> m[i];
if(i > 0 && m[tag] < m[i])
{
tag = i;
}
} m[tag] -= 1; for(int i = 0; i < 3; ++i)
{
if(i != tag)
{
ans[i] = m[tag] - m[i];
if(ans[i] > 0)
an += ans[i];
}
} return 0;
}

CF DIV.2 变成6题,前两道有点水。。

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

  1. Codeforces Round #377 (Div. 2) D. Exams

    Codeforces Round #377 (Div. 2) D. Exams    题意:给你n个考试科目编号1~n以及他们所需要的复习时间ai;(复习时间不一定要连续的,可以分开,只要复习够ai天 ...

  2. Codeforces Round #377 (Div. 2)D(二分)

    题目链接:http://codeforces.com/contest/732/problem/D 题意: 在m天中要考k个课程, 数组a中有m个元素,表示第a[i]表示第i天可以进行哪门考试,若a[i ...

  3. Codeforces Round #377 (Div. 2) E. Sockets

    http://codeforces.com/contest/732/problem/E 题目说得很清楚,每个电脑去插一个插座,然后要刚好的,电脑的power和sockets的值相同才行. 如果不同,还 ...

  4. Codeforces Round #377 (Div. 2) D. Exams 贪心 + 简单模拟

    http://codeforces.com/contest/732/problem/D 这题我发现很多人用二分答案,但是是不用的. 我们统计一个数值all表示要准备考试的所有日子和.+m(这些时间用来 ...

  5. Codeforces Round #377 (Div. 2) 被坑了

    http://codeforces.com/contest/732/problem/B 题目要求任意两个连续的日子都要 >= k 那么如果a[1] + a[2] < k,就要把a[2]加上 ...

  6. Codeforces Round #377 (Div. 2)A,B,C,D【二分】

    PS:这一场真的是上分场,只要手速快就行.然而在自己做的时候不用翻译软件,看题非常吃力非常慢,还有给队友讲D题如何判断的时候又犯了一个毛病,一定要心平气和,比赛也要保证,不要用翻译软件做题: Code ...

  7. Codeforces Round #377 (Div. 2) B. Cormen — The Best Friend Of a Man(贪心)

     传送门 Description Recently a dog was bought for Polycarp. The dog's name is Cormen. Now Polycarp has ...

  8. Codeforces Round #377 (Div. 2) D. Exams(二分答案)

    D. Exams Problem Description: Vasiliy has an exam period which will continue for n days. He has to p ...

  9. Codeforces Round #377 (Div. 2) C. Sanatorium 水题

    C. Sanatorium time limit per test 1 second memory limit per test 256 megabytes input standard input ...

随机推荐

  1. expect实现自动登录

    自动登录主机(ssh) 建脚本item2login.sh,包含如下内容 #!/usr/bin/expect set timeout 30 spawn ssh -p [lindex $argv 0] [ ...

  2. centos7 开放端口

    开启端口 firewall-cmd --zone=public --add-port=80/tcp --permanent 命令含义:   --zone #作用域   --add-port=80/tc ...

  3. 在布局文件中使用Fragment的步骤

    为了在Activity布局文件中使用Fragment我们需要四个步骤. 1.定义一个Activity,他继承android.support.v4.app.FragmentActivity,下面是关键代 ...

  4. HTML5的File API读取文件信息

    html结构: <div id="fileImage"></div> <input type="file" value=" ...

  5. Windows Defender无法开启问题

    针对Win8及以上系统: 按Win+R键,输入services.msc,下滑找到以W开头的Windows Defender相关项,右键在属性中设为自动并开启. (若1无法解决)按Win+R键,输入re ...

  6. (转)C#根据当前时间获取周,月,季度,年度等时间段的起止时间

    DateTime dt = DateTime.Now; //当前时间 DateTime startWeek = dt.AddDays( - Convert.ToInt32(dt.DayOfWeek.T ...

  7. title换行

  8. 【EasyUI】 日期格式化

    本文经过了测试,解决getFullyear() is not a function等问题 效果如下: 首先: Oracle中字段设置为DATE,MySQL中设置为DATETIME,MyBatis中会自 ...

  9. jquery判断多个input输入框不能输入相同的值

    function checkName(data){ //校验联系信息不能一致 var values=""; $(".t").each(function(i,it ...

  10. iOS web remote debug 正确的姿势

    在使用iOS Remote debug需要做以下准备 1. iOS devices 开启java script and web inspector 开启方式如下: 2. mac OS 自带的Safar ...