Heim  >  Artikel  >  Datenbank  >  A. Counterexample (Codeforces Round #275(div2)

A. Counterexample (Codeforces Round #275(div2)

WBOY
WBOYOriginal
2016-06-07 15:31:351090Durchsuche

Note In the first sample pair (2,?4) is not coprime and pairs (2,?3) and (3,?4) are. In the second sample you cannot form a group of three distinct integers, so the answer is -1. In the third sample it is easy to see that numbers 900000000

Note

In the first sample pair (2,?4) is not coprime and pairs (2,?3) and (3,?4) are.

In the second sample you cannot form a group of three distinct integers, so the answer is -1.

In the third sample it is easy to see that numbers 900000000000000009 and 900000000000000021 are divisible by three.

找出3个数,前两个的最大公约数为1,后两个最大公约数为1,第1个和第3个的最大公约数不为1.

由于题目中说了,r-l

代码:

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
long long gcd(long long a,long long b)
{
    return b==0?a:gcd(b,a%b);
}
int main()
{
    long long l,r;
    long long x,y,z;
    int sign=0;
    scanf("%I64d%I64d",&l,&r);
    for(long long i=l;i<br>
<br>



</cstring></algorithm></cstdio></iostream>
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn