A. Johny Likes Numbers

题目连接:

http://www.codeforces.com/contest/678/problem/A

Description

Johny likes numbers n and k very much. Now Johny wants to find the smallest integer x greater than n, so it is divisible by the number k.

Input

The only line contains two integers n and k (1 ≤ n, k ≤ 109).

Output

Print the smallest integer x > n, so it is divisible by the number k.

Sample Input

5 3

Sample Output

6

Hint

题意

找到一个大于n的最小值p,使得p%k==0

题解:

O1公式题

答案是(n/k+1)k

显然。

代码

#include<bits/stdc++.h>
using namespace std;
const int inf = 1e9;
int main()
{
long long n,k;
cin>>n>>k;
cout<<(n/k+1)*k<<endl;
return 0;
}

Educational Codeforces Round 13 A. Johny Likes Numbers 水题的更多相关文章

  1. Educational Codeforces Round 13 D. Iterated Linear Function 水题

    D. Iterated Linear Function 题目连接: http://www.codeforces.com/contest/678/problem/D Description Consid ...

  2. Educational Codeforces Round 13 C. Joty and Chocolate 水题

    C. Joty and Chocolate 题目连接: http://www.codeforces.com/contest/678/problem/C Description Little Joty ...

  3. Educational Codeforces Round 13 B. The Same Calendar 水题

    B. The Same Calendar 题目连接: http://www.codeforces.com/contest/678/problem/B Description The girl Tayl ...

  4. Educational Codeforces Round 14 A. Fashion in Berland 水题

    A. Fashion in Berland 题目连接: http://www.codeforces.com/contest/691/problem/A Description According to ...

  5. Educational Codeforces Round 4 A. The Text Splitting 水题

    A. The Text Splitting 题目连接: http://www.codeforces.com/contest/612/problem/A Description You are give ...

  6. Educational Codeforces Round 11 B. Seating On Bus 水题

    B. Seating On Bus 题目连接: http://www.codeforces.com/contest/660/problem/B Description Consider 2n rows ...

  7. Codeforces Educational Codeforces Round 3 B. The Best Gift 水题

    B. The Best Gift 题目连接: http://www.codeforces.com/contest/609/problem/B Description Emily's birthday ...

  8. Codeforces Educational Codeforces Round 3 A. USB Flash Drives 水题

    A. USB Flash Drives 题目连接: http://www.codeforces.com/contest/609/problem/A Description Sean is trying ...

  9. Educational Codeforces Round 12 A. Buses Between Cities 水题

    A. Buses Between Cities 题目连接: http://www.codeforces.com/contest/665/problem/A Description Buses run ...

随机推荐

  1. gcc编译选项【转】

    转自:https://blog.csdn.net/rheostat/article/details/19811407 常用选项 -E:只进行预处理,不编译-S:只编译,不汇编-c:只编译.汇编,不链接 ...

  2. Vue 进阶教程之:详解 v-model

    分享 Vue 官网教程上关于 v-model 的讲解不是十分的详细,写这篇文章的目的就是详细的剖析一下, 并介绍 Vue 2.2 v-model改进的地方,然后穿插的再说点 Vue 的小知识. 在 V ...

  3. CRF条件随机场

    CRF的进化 https://flystarhe.github.io/2016/07/13/hmm-memm-crf/参考: http://blog.echen.me/2012/01/03/intro ...

  4. Fiddler 4 抓包(APP HTTPS )

    一.手机连接Fiddler 1.配置fiddler 1.安装fiddler,基本下一步下一步即可: 2.打开fiddler,点击顶部栏Tools——>Options 3.在HTTPS页签勾选“D ...

  5. 读书笔记--C陷阱与缺陷(六)

    第六章 1.预处理器:预处理器先对代码进行必要的转换处理,简化编程者的工作. 它的重要原因有以下两点: a. 假如要将程序中出现的所有实例都加以修改,但希望只改动程序一处数值,重新编译实现. 预处理器 ...

  6. java 学习网站

    http://how2j.cn/  教学网站 慕课视频下载网站 http://www.feemic.cn/mooc //慕课搜索和下载的网站http://www.soshoulu.com/tools/ ...

  7. HDU 1669 Jamie's Contact Groups(多重匹配+二分枚举)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1669 题目大意: 给你各个人可以属于的组,把这些人分组,使这些组中人数最多的组人数最少,并输出这个人数 ...

  8. python图片处理(二)

    python中图像处理有pillow和skimage 图像中一般有个RGBA值,RGB顾名思义就是红绿蓝值,A表示alpha表示是透明度. from PIL import ImageColor pri ...

  9. LeetCode691. Stickers to Spell Word

    We are given N different types of stickers. Each sticker has a lowercase English word on it. You wou ...

  10. Shell学习笔记:#*、%*字符串掐头去尾方法

    一.语法 在shell中可以通过#.%对字符串进行掐头去尾操作,使用方法如下: # 表示掐头 % 表示去尾 单个#或%表示最小匹配 双个$或%表示最大匹配  二.例子1 假设我们定义一个变量为: fi ...