
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)
👁️ 阅读量:0
© 版权声明:本文《1088A. Ehab and another construction problem》内容均为本站精心整理或网友自愿分享,如需转载请注明原文出处:https://www.zastudy.cn/wen/1686508883a274457.html。