1088A. Ehab and another construction problem
阿新 • • 發佈:2018-12-29
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
10
output
Copy
6 3
input
Copy
1
output
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)