题解 | 小红的正整数构造
小红的正整数构造
https://www.nowcoder.com/practice/7aa37cbc28034fe5af562ec7e44d1e76
寻找位于区间[l,r]内的x倍数
l, r, x = map(int, input().split()) i = 1 n = x*i while True: if n>r: print(-1) break if l<=n<=r: print(n) break n += x
小红的正整数构造
https://www.nowcoder.com/practice/7aa37cbc28034fe5af562ec7e44d1e76
寻找位于区间[l,r]内的x倍数
l, r, x = map(int, input().split()) i = 1 n = x*i while True: if n>r: print(-1) break if l<=n<=r: print(n) break n += x
相关推荐