CodeForces - 1088A Ehab and another construction problem 水
原创
©著作权归作者所有:来自51CTO博客作者mb5f5b1df7f1e34的原创作品,请联系作者获取转载授权,否则将追究法律责任
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≤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
Copy
10
output
Copy
6 3
input
Copy
1
output
Copy
-1
#include<cstdio>
#include<iostream>
#include<fstream>
#include<algorithm>
#include<functional>
#include<cstring>
#include<string>
#include<cstdlib>
#include<iomanip>
#include<numeric>
#include<cctype>
#include<cmath>
#include<ctime>
#include<queue>
#include<stack>
#include<list>
#include<set>
#include<map>
using namespace std;
#define N 100000+5
#define rep(i,n) for(int i=0;i<n;i++)
#define sd(n) scanf("%d",&n)
#define sll(n) scanf("%lld",&n)
#define pd(n) scanf("%d\n",n)
#define pll(n) scanf("%lld\n",n)
#define MAX 26
typedef long long ll;
const ll mod=1e9+7;
ll n,m;
ll a[N];
ll b[N];
int main()
{
//string s;
//cin>>s;
ll ans=0;
//ll sum=0;
ll x,y,d;
scanf("%lld",&n);
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)
{
flag=1;
x=i;y=j;
break;
}
}if(flag==1) break;
}
if(flag==1)
printf("%lld %lld\n",x,y);
else
{
printf("-1\n");
}
/*for(int i=0;i<n;i++)
{
scanf("%lld%lld",&a[i],&b[i]);
} */
//for(int i=1;i<=n;i++)
// printf("%lld",a[i]);
return 0;
}