题解 | 小红的正整数构造
小红的正整数构造
https://www.nowcoder.com/practice/7aa37cbc28034fe5af562ec7e44d1e76
#include <bits/stdc++.h>
using namespace std;
int main() {
int l, r, x;
cin>>l>>r>>x;
int m=0;
for(int i=l;i<=r;i++){
if(i%x==0){
m=i;
break;
}
}
if(m!=0){
cout<<m;
}
else{
cout<<-1;
}
}
// 64 位输出请用 printf("%lld")