Educational Codeforces Round 13 A、B、C、D
A. Johny Likes Numbers
time limit per test
0.5 secondsmemory limit per test
256 megabytesinput
standard inputoutput
standard outputJohny 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.
Examples
input
5 3
output
6
input
25 13
output
26
input
26 13
output
39
题意:找到一个大于n并且被k整除的最小的数;
思路:除+1;

#include<bits/stdc++.h> using namespace std; #define ll __int64 #define mod 1000000007 #define pi (4*atan(1.0)) const int N=1e3+10,M=1e6+10,inf=1e9+10; int main() { int x,y,z,i,t; scanf("%d%d",&x,&y); printf("%I64d\n",(ll)(x/y+1)*y); return 0; }