Time limit : 2sec / Memory limit : 256MB

Score : 100 points

Problem Statement

You are given positive integers X and Y. If there exists a positive integer not greater than 1018 that is a multiple of X but not a multiple of Y, choose one such integer and print it. If it does not exist, print −1.

Constraints

  • 1≤X,Y≤109
  • X and Y are integers.

Input

Input is given from Standard Input in the following format:

X Y

Output

Print a positive integer not greater than 1018 that is a multiple of X but not a multiple of Y, or print −1 if it does not exist.


Sample Input 1

Copy
8 6

Sample Output 1

Copy
16

For example, 16 is a multiple of 8 but not a multiple of 6.


Sample Input 2

Copy
3 3

Sample Output 2

Copy
-1

A multiple of 3 is a multiple of 3.

只需要判断x是否是y的倍数。

代码:

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iomanip>
using namespace std;
int a,b;
int main()
{
cin>>a>>b;
if(a % b)cout<<a;
else cout<<-;
}

最新文章

  1. delphi 实现最小化系统托盘
  2. Oracle执行计划详解
  3. 队列的JS实现
  4. OS.js – 开源的 Web OS 系统,赶快来体验
  5. vs2015打包winform程序遇到的一系列问题
  6. cmd for备忘
  7. 转 状态压缩DP
  8. 用distinct在MySQL中查询多条不重复记录值[转]
  9. word2007二级标题自动编号不从大标题开始的解决方法
  10. Java 线程综述
  11. 【转载】学习C#的28条建议
  12. Swift学习笔记十五
  13. 【Zookeeper学习】Apache Zookeeper项目简介
  14. Decimal
  15. SGU题目总结
  16. Linux-Nand Flash驱动(分析MTD层并制作NAND驱动)
  17. [JSOI2007]建筑抢修
  18. Docker : Tomcat Clustering with Load Balancer (Tomcat and Nginx)
  19. JS ----实现复制粘贴功能 (剪切板应用clipboardData)
  20. (reverse)Palindromes hdu2163

热门文章

  1. Linux用户和用户组管理 用户组管理命令
  2. flume 使用遇到问题及解决
  3. idea创建git分支
  4. ViewPagerAdapter 示例
  5. Codeforces Round #425 (Div. 2) D 树链剖分 + 树状数组维护区间
  6. python global
  7. DelphiXE
  8. FreeTDS-SQL Server在linux和unix下的免费驱动
  9. Linux01
  10. 设计高效sql一般经验谈