https://codeforces.com/contest/1101/problem/A
第一次尝试用python写程序,输入输出和C语言还是有很大的区别的,以后这种简单题多尝试一下py写法,当多掌握一种语言了
c++
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#define ll long long
#define mod 1000000007
#define inf 0x3f3f3f3f
using namespace std;
int main()
{
int t;
int l, r, d;
cin>>t;
while(t --)
{
cin>>l>>r>>d;
int ans = d;
if(ans < l)
{
cout<<d<<endl;
}
else if(ans > r)
{
cout<<ans<<endl;
}
else
{
cout<<ans + ((r - ans)/ans + 1) * ans<<endl;
}
}
return 0;
}
py3
t = int(input())
for i in range(t):
a, b, c = map(int, input().split())
if c < a:
print(c)
elif c > b:
print(c)
else:
print(c + ((b - c) // c + 1) * c)