Given an integer xx, find 2 integers aa and bb such that:
1≤a,b≤x1≤a,b≤x
bb divides aa (aa is divisible by bb).
a⋅b>xa⋅b>x.
ab<xab<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
10
Output
6 3
Input
1
Output
-1
直接暴力不多说
代码如下:
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int n;
int main()
{
while(scanf("%d",&n)!=EOF)
{
int flag=0;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
{
if(i%j==0&&i*j>n&&i/j<n)
{
printf("%d %d\n",i,j);
flag=1;
break;
}
}
if (flag==1) break;
}
if(flag) continue;
else cout<<"-1"<<endl;
}
}
努力加油a啊,(o)/~