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 ...
随机推荐
- python基础-类的继承
继承:承创建的新类称为“子类”或“派生类”,被继承的类称为“基类”.“父类. 继承的过程,就是从一般到特殊的过程.要实现继承,可以通过“继承”(Inheritance)和“组合”(Compositio ...
- java基础57 css样式、选择器和css定位(网页知识)
本文知识点(目录): 1.CSS样式 2.选择器 3.CSS定位 1.CSS样式 1.html 在一个网页中负责的是一个页面的结构 2.css(层叠样式表)在一个页面中负责了一个页面 ...
- ubuntu和windows双系统启动顺序的修改
ubuntu和windows双系统启动顺序的修改 说到启动就不得不说GRUB,Linux下大名鼎鼎的启动管理工具(曾经的LILO已经风光不再),当然现在已经是GRUB2了,GRUB2和GRUB最重要的 ...
- Effective STL 学习笔记 31:排序算法
Effective STL 学习笔记 31:排序算法 */--> div.org-src-container { font-size: 85%; font-family: monospace; ...
- CentOS 6.5通过yum安装和配置MySQL
0x00 说明 Linux安装MySQL一共有两种方式,一种是下载安装包离线安装,另一种就是通过yum在线安装,这里先介绍在线安装的方式,此方法简单方便,出错最少,但是无法控制安装的MySQL版本,如 ...
- Kotlin尝试
Kotlin 是一种静态类型的编程语言,可在 Java 虚拟机上运行,也可以编译为 JavaScript 源代码.其主要发展来自位于俄罗斯圣彼得堡的 JetBrains 程序员团队.虽然语法与 Jav ...
- 【转】Android开启网络调试的方法
方法是偶然看到的: Android 终端adbd服务需要开启5555号端口来建立于adb的连接,如果未开启5555端口,则不能通过网络调试 查看是否可以网络调试: # netstat Android ...
- loadrunner——常见函数
loadrunner——常见函数 分类: LoadRunner 2012-04-11 20:41 703人阅读 评论(0) 收藏 举报 loadrunnersearchweb服务器脚本stringwe ...
- 警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:fhcq-oa' did not find a matching property.
当你在使用Eclipse运行web项目时,你可能会看到控制台出现: 警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Settin ...
- 【Java】 Scanner类的几个方法
通过 Scanner 类可以获取用户的输入,创建 Scanner 对象的基本语法如下: Scanner sc = new Scanner(System.in); nextInt().next()和ne ...