codeforces round #525 (div. 2) (2)

博主链接

题目链接

题意:

给你一个x,让你求出两个整数a,b,满足他给的那些条件

题解:

数据范围很小就100,直接O(n*n)暴力枚举就可以了

代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e6+7;
const int mod=1e9+7;
int (){
int x;
scanf("%d",&x);
for(int i=1;i<=x;i++){
for(int j=1;j<=i;j++){
if(i%j==0&&j*i>x){
printf("%d %dn",i,j);
return 0;
}
}
}
printf("-1n");
return 0;
}