CF 275A. Counterexample

http://codeforces.com/contest/483/problem/A
题目大意  给出区间 x~y  然我们举出在区间中的三个数  a b c  满足 ab,bc互质 ac不互质,如果没有输出-1。暴力枚举就行
最坏50*49*48。~~

#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<vector>
#include<cmath>
#include<stdlib.h>
#include<iomanip>
#include<list>
#include<deque>
#include<map>
#include <stdio.h>
#include <queue>

#define maxn 10000+5
#define ull unsigned long long
#define ll long long
#define reP(i,n) for(i=1;i<=n;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define cle(a) memset(a,0,sizeof(a))
#define mod 90001
#define PI 3.141592657
#define INF 1<<30
const ull inf = 1LL << 61;
const double eps=1e-5;

using namespace std;

bool cmp(int a,int b){
return a>b;
}
ll gcd(ll a,ll b)///36 24
{
return b==0?a:gcd(b,a% b);
}
bool judge(ll a,ll b)
{
if(gcd(a,b)==1)return true;
else return false;
}
int main()
{
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
ll a,b;
cin>>a>>b;
for(ll i=a;i<=b;i++)
{
for(ll j=i+1;j<=b;j++)
{
for(ll k=j+1;k<=b;k++)
if(judge(i,j)&&judge(j,k)&&(!judge(i,k))){cout<<i<<" "<<j<<" "<<k<<endl;return 0;}
}
}
cout<<-1<<endl;
return 0;
}



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值