Educational Codeforces Round 13 A. Johny Likes Numbers 水题
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 水题的更多相关文章
- Educational Codeforces Round 13 D. Iterated Linear Function 水题
D. Iterated Linear Function 题目连接: http://www.codeforces.com/contest/678/problem/D Description Consid ...
- Educational Codeforces Round 13 C. Joty and Chocolate 水题
C. Joty and Chocolate 题目连接: http://www.codeforces.com/contest/678/problem/C Description Little Joty ...
- Educational Codeforces Round 13 B. The Same Calendar 水题
B. The Same Calendar 题目连接: http://www.codeforces.com/contest/678/problem/B Description The girl Tayl ...
- Educational Codeforces Round 14 A. Fashion in Berland 水题
A. Fashion in Berland 题目连接: http://www.codeforces.com/contest/691/problem/A Description According to ...
- Educational Codeforces Round 4 A. The Text Splitting 水题
A. The Text Splitting 题目连接: http://www.codeforces.com/contest/612/problem/A Description You are give ...
- Educational Codeforces Round 11 B. Seating On Bus 水题
B. Seating On Bus 题目连接: http://www.codeforces.com/contest/660/problem/B Description Consider 2n rows ...
- 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 ...
- 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 ...
- Educational Codeforces Round 12 A. Buses Between Cities 水题
A. Buses Between Cities 题目连接: http://www.codeforces.com/contest/665/problem/A Description Buses run ...
随机推荐
- shell脚本实现分日志级别输出
shell脚本如何优雅的记录日志信息,下面让我们一步一步,让shell脚本的日志也变得高端起来,实现如下功能 ①设定日志级别,实现可以输出不同级别的日志信息,方便调试 ②日志格式类似为:[日志级别] ...
- nfs挂载出错:mount.nfs: access denied by server while mounting
这个问题就是服务器不允许客户端去挂载,那么修改服务端的权限 $ sudo vi /etc/hosts.deny 文本末添加 ### NFS DAEMONS portmap: ALL lockd: AL ...
- keras LSTM中间的dropout
TM有三个 model.add(LSTM(100, dropout=0.2, recurrent_dropout=0.2)) 第一个dropout是x和hidden之间的dropout,第二个是hid ...
- 使用html+css+js实现3D相册
使用html+css+js实现3D相册,快来上传的照片吧 效果图: 代码如下,复制即可用: <!DOCTYPE html> <html lang="en"> ...
- 异步消息框架netty
Netty-WebSocket长连接推送服务 http://blog.csdn.net/z69183787/article/details/52505249 http://blog.csdn.net/ ...
- Codeforces 2B The least round way(dp求最小末尾0)
题目链接:http://codeforces.com/problemset/problem/2/B 题目大意: 给你一个nxn的矩形,找到一条从左上角到右下角的路径,使得该路径上所有数字的乘积的末尾0 ...
- CVE-2013-3346Adobe Reader和Acrobat 内存损坏漏洞分析
[CNNVD]Adobe Reader和Acrobat 内存损坏漏洞(CNNVD-201308-479) Adobe Reader和Acrobat都是美国奥多比(Adobe)公司的产品.Adobe R ...
- WeifenLuo.WinFormsUI.Docking"的使用
要用 WeifenLuo.WinFormsUI.Docking 首先要下载: WeifenLuo.WinFormsUI.Docking 在当前工程“解决方案 - 引用”中 >> 右击引用 ...
- MongoDB查询用法大全
转载 http://blog.163.com/lgh_2002/blog/static/440175262012052116455/ 详见官方的手册: http://www.mongodb.org/d ...
- GridView练习题
package com.example.wang.myapplication; import android.os.Bundle; import android.support.v7.app.AppC ...