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.
Examples
input
5 3
output
6
input
25 13
output
26
input
26 13
output
39嗯,这个就没必要说了吧,找n与k的关系
1 #include<iostream> 2 #include<stdio.h> 3 #include<algorithm> 4 #include<string.h> 5 using namespace std; 6 int a,b,c; 7 long long n,t; 8 int main() 9 { 10 long long k; 11 long long sum; 12 cin>>n>>k; 13 cout<<(n/k+1)*k<<endl; 14 return 0; 15 }
时间: 2024-11-05 12:24:48