Skip to content

Instantly share code, notes, and snippets.

@jinnatul
Created January 14, 2019 16:10
Show Gist options
  • Save jinnatul/37e05ff5e320154270cfda8df92e8d7e to your computer and use it in GitHub Desktop.
Save jinnatul/37e05ff5e320154270cfda8df92e8d7e to your computer and use it in GitHub Desktop.
#include<bits/stdc++.h>
using namespace std;
/// Typedef
typedef long long ll;
#define sc1(a) scanf("%lld",&a)
#define sc2(a,b) scanf("%lld %lld",&a,&b)
#define pf1(a) printf("%lld\n",a)
#define pf2(a,b) printf("%lld %lld\n",a,b)
#define mx 10000007
#define mod 100000007
#define PI acos(-1.0)
int dr[] = {-2,-2,-1,-1,1,1,2,2};
int dc[] = {-1,1,-2,2,-2,2,-1,1};
int main()
{
ll num, m, tc = 1;
sc1(tc);
while (tc--){
ll l, r, d;
cin >> l >> r >> d;
if(d < l || r < d) cout << d << endl;
else{
ll ans = r / d + 1;
pf1(ans * d);
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment