admin管理员组文章数量:1794759
1088A. Ehab and another construction problem
A. Ehab and another construction problem
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
Given an integer xx, find 2 integers aa and bb such that:
- 1≤a,b≤x
- b divides a (a is divisible by b).
- a⋅b>x
- a/b<x
Input
The only line contains the integer xx (1≤x≤100)(1≤x≤100).
Output
You should output two integers aa and bb, satisfying the given conditions, separated by a space. If no pair of integers satisfy the conditions above, print "-1" (without quotes).
Examples
input
Copy
10output
Copy
6 3input
Copy
1output
Copy
-1
题意:给了一个数想x,找出两个数a,b满足一下条件:
- 1≤a,b≤x
- b能够除a
- a⋅b>x
- a/b<x
输出找找到的两个数,没有就输出-1.
题解:发现除1以外的数都有两个数满足条件,而且x只要大于1,a,b最简单的就是x。
c++:
#include<bits/stdc++.h> using namespace std; int main() { int x; cin>>x; if(x==1) puts("-1"); else cout<<x<<" "<<x<<endl; return 0; }python:
x=input() print(-1 if x=="1" else x+" "+x)
本文标签: EhabproblemConstruction
版权声明:本文标题:1088A. Ehab and another construction problem 内容由林淑君副主任自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.xiehuijuan.com/baike/1686508666a75498.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论