首页 web前端 html教程 Codeforces Round #275 (Div. 2)A Countexample_html/css_WEB-ITnose

Codeforces Round #275 (Div. 2)A Countexample_html/css_WEB-ITnose

Jun 24, 2016 am 11:55 AM

题目链接:Counterexample



Counterexample

time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

Your friend has recently learned about coprime numbers. A pair of numbers {a,?b} is called coprime if the maximum number that divides both a and b is equal to one.

Your friend often comes up with different statements. He has recently supposed that if the pair (a,?b) is coprime and the pair (b,?c) is coprime, then the pair (a,?c) is coprime.

You want to find a counterexample for your friend's statement. Therefore, your task is to find three distinct numbers (a,?b,?c), for which the statement is false, and the numbers meet the condition l?≤?a?

More specifically, you need to find three numbers (a,?b,?c), such that l?≤?a?

Input

The single line contains two positive space-separated integers l, r (1?≤?l?≤?r?≤?1018; r?-?l?≤?50).

Output

Print three positive space-separated integers a, b, c ? three distinct numbers (a,?b,?c) that form the counterexample. If there are several solutions, you are allowed to print any of them. The numbers must be printed in ascending order.

If the counterexample does not exist, print the single number -1.

Sample test(s)

input

2 4
登录后复制

output

2 3 4
登录后复制

input

10 11
登录后复制

output

-1
登录后复制

input

900000000000000009 900000000000000029
登录后复制

output

900000000000000009 900000000000000010 900000000000000021
登录后复制

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.






大致题意:给定l和r,找出满足条件 l?≤?a?


解题思路:暴力枚举。枚举所有的情况,对每个情况进行判断。这种做法的前提是数据不大,数据要是大了,就不能这么直接暴力了。





AC代码:

#include <stdio.h>#include <string.h>#include <iostream>#include <algorithm>#include <vector>#include <queue>#include <set>#include <map>#include <string>#include <math.h>#include <stdlib.h>#include <time.h>using namespace std;#define INF 0x7fffffff#define LL long longLL gcd(LL a, LL b){    if(!b) return a;    return gcd(b, a%b);}int main(){    #ifdef sxk        freopen("in.txt","r",stdin);    #endif    LL l,r,a,b,c;    while(scanf("%lld%lld",&amp;l,&amp;r)!=EOF)    {        int flag = 0;        for(LL i=l; i  <br>  <br>  <p></p>  <p><br> </p>  <p><br> </p>  <p><br> </p> </time.h></stdlib.h></math.h></string></map></set></queue></vector></algorithm></iostream></string.h></stdio.h>
登录后复制
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

热门文章

R.E.P.O.能量晶体解释及其做什么(黄色晶体)
1 周前 By 尊渡假赌尊渡假赌尊渡假赌
仓库:如何复兴队友
3 周前 By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island冒险:如何获得巨型种子
3 周前 By 尊渡假赌尊渡假赌尊渡假赌

热门文章

R.E.P.O.能量晶体解释及其做什么(黄色晶体)
1 周前 By 尊渡假赌尊渡假赌尊渡假赌
仓库:如何复兴队友
3 周前 By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island冒险:如何获得巨型种子
3 周前 By 尊渡假赌尊渡假赌尊渡假赌

热门文章标签

记事本++7.3.1

记事本++7.3.1

好用且免费的代码编辑器

SublimeText3汉化版

SublimeText3汉化版

中文版,非常好用

禅工作室 13.0.1

禅工作室 13.0.1

功能强大的PHP集成开发环境

Dreamweaver CS6

Dreamweaver CS6

视觉化网页开发工具

SublimeText3 Mac版

SublimeText3 Mac版

神级代码编辑软件(SublimeText3)

公众号网页更新缓存难题:如何避免版本更新后旧缓存影响用户体验? 公众号网页更新缓存难题:如何避免版本更新后旧缓存影响用户体验? Mar 04, 2025 pm 12:32 PM

公众号网页更新缓存难题:如何避免版本更新后旧缓存影响用户体验?

如何使用HTML5表单验证属性来验证用户输入? 如何使用HTML5表单验证属性来验证用户输入? Mar 17, 2025 pm 12:27 PM

如何使用HTML5表单验证属性来验证用户输入?

如何高效地在网页中为PNG图片添加描边效果? 如何高效地在网页中为PNG图片添加描边效果? Mar 04, 2025 pm 02:39 PM

如何高效地在网页中为PNG图片添加描边效果?

&lt; iframe&gt;的目的是什么。 标签?使用时的安全考虑是什么? &lt; iframe&gt;的目的是什么。 标签?使用时的安全考虑是什么? Mar 20, 2025 pm 06:05 PM

&lt; iframe&gt;的目的是什么。 标签?使用时的安全考虑是什么?

&lt; datalist&gt;的目的是什么。 元素? &lt; datalist&gt;的目的是什么。 元素? Mar 21, 2025 pm 12:33 PM

&lt; datalist&gt;的目的是什么。 元素?

&lt; meter&gt;的目的是什么。 元素? &lt; meter&gt;的目的是什么。 元素? Mar 21, 2025 pm 12:35 PM

&lt; meter&gt;的目的是什么。 元素?

HTML5中跨浏览器兼容性的最佳实践是什么? HTML5中跨浏览器兼容性的最佳实践是什么? Mar 17, 2025 pm 12:20 PM

HTML5中跨浏览器兼容性的最佳实践是什么?

使用IFRAME的安全性含义是什么?如何减轻它们? 使用IFRAME的安全性含义是什么?如何减轻它们? Mar 18, 2025 pm 02:51 PM

使用IFRAME的安全性含义是什么?如何减轻它们?

See all articles