「CodeForces 476A」Dreamoon and Stairs 暴力枚举
题意翻译
题面 DM小朋友想要上一个有 n 级台阶的楼梯。他每一步可以上 1 或 2 级台阶。假设他走上这个台阶一共用了 x 步。现在DM想知道 x 是否可能为 m 的倍数。如果可能,输出 x 的最小值。如果不可能,输出 −1
输入 两个正整数 n,m(n≤10000,m≤10)
输出 按要求输出 x 或 −1
题目描述
Dreamoon wants to climb up a stair of nn steps. He can climb 1 or 2 steps at each move. Dreamoon wants the number of moves to be a multiple of an integer m .
What is the minimal number of moves making him climb to the top of the stairs that satisfies his condition?
输入输出格式
输入格式:
The single line contains two space separated integers n , m (0<n≤10000,1<m≤10).
输出格式:
Print a single integer — the minimal number of moves being a multiple of m . If there is no way he can climb satisfying condition print −1 instead.
输入输出样例
输入样例#1:
10 2
输出样例#1