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. JavaScript 金额、数字、千分位、千分位、保留几位小数、舍入舍去、支持负数

    JavaScript 金额.数字 千分位格式化.保留指定位数小数.支持四舍五入.进一法.去尾法 字段说明: number:需要处理的数字: decimals:保留几位小数,默认两位,可不传: dec_ ...

  2. java map遍历并删除特定值

    删除map中包含password和username的键值对 若是在map中直接删除,会指针错误 Iterator<Map.Entry<String,Object>> it = ...

  3. 十二、springboot之web开发之静态资源处理

    springboot静态资源处理 Spring Boot 默认为我们提供了静态资源处理,使用 WebMvcAutoConfiguration 中的配置各种属性. 建议大家使用Spring Boot的默 ...

  4. html-示例代码

    <!DOCTYPE html> <html lang="en" xmlns="http://www.w3.org/1999/html" xml ...

  5. Flask form

    用户登录 #!/usr/bin/env python # -*- coding:utf- -*- from flask import Flask, render_template, request, ...

  6. LeetCode691. Stickers to Spell Word

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

  7. Bridge 桥接

    意图 将抽象部分与它的实现部分分离,使它们都可以独立地变化. 动机 当一个抽象可能有多个实现时,通常用继承来协调它们.抽象类定义对该抽象的接口,而具体的子类则用不同方式加以实现.但是此方法有时不够灵活 ...

  8. Bad connection to FS. command aborted. exception: Call to chaoren/192.168.80.100:9000 failed on connection exception: java.net.ConnectException: Connection refused

    Bad connection to FS. command aborted. exception: Call to chaoren/192.168.80.100:9000 failed on conn ...

  9. Java人员正确使用 IntelliJ IDEA的方式

    原文: http://tengj.top/2017/02/22/idea1-1/ 作者: 嘟嘟MD 前言 博主是Java开发人员,以前一直都用myeclipse来开发的,说实话感觉myeclipse毫 ...

  10. hdoj1203 I NEED A OFFER!(DP,01背包)

    题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=1203 思路 求最少能收到一份offer的最大概率,可以先求对立面:一份offer也收不到的最小概率,然 ...