【HDU - 2149】Public Sale (巴什博奕)

题干:

  

虽然不想,但是现实总归是现实,Lele始终没有逃过退学的命运,因为他没有拿到奖学金。现在等待他的,就是像FarmJohn一样的农田生涯。 

要种田得有田才行,Lele听说街上正在举行一场别开生面的拍卖会,拍卖的物品正好就是一块20亩的田地。于是,Lele带上他的全部积蓄,冲往拍卖会。 

后来发现,整个拍卖会只有Lele和他的死对头Yueyue。 

通过打听,Lele知道这场拍卖的规则是这样的:刚开始底价为0,两个人轮流开始加价,不过每次加价的幅度要在1~N之间,当价格大于或等于田地的成本价 M 时,主办方就把这块田地卖给这次叫价的人。 

Lele和Yueyue虽然考试不行,但是对拍卖却十分精通,而且他们两个人都十分想得到这块田地。所以他们每次都是选对自己最有利的方式进行加价。 

由于Lele字典序比Yueyue靠前,所以每次都是由Lele先开始加价,请问,第一次加价的时候, 
Lele要出多少才能保证自己买得到这块地呢? 

Input

本题目包含多组测试,请处理到文件结束(EOF)。每组测试占一行。 
每组测试包含两个整数M和N(含义见题目描述,0<N,M<1100) 

Output

对于每组数据,在一行里按递增的顺序输出Lele第一次可以加的价。两个数据之间用空格隔开。
如果Lele在第一次无论如何出价都无法买到这块土地,就输出"none"。 

Sample Input

4 2
3 2
3 5

Sample Output

1
none
3 4 5

解题报告:

    简单的巴什博弈,用PN图也可以看出来这个规律。

AC代码:

#include<bits/stdc++.h>using namespace std;
int m,n;
int main()
{while(~scanf("%d%d",&m,&n)) {if(n>=m) {for(int i = m; i<=n; i++) {printf("%d%c",i,i==n? '\n' : ' ' );}}else {if(m%(n+1)==0) {printf("none\n");}else {printf("%d\n",m%(n+1));}}}return 0 ;
}

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/441594.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Android万能遥控菜单选择添加,Android万能遥控器小应用

在很久很久以前&#xff0c;手机是有红外功能的&#xff0c;后来随着蓝牙技术的成熟&#xff0c;红外逐渐被蓝牙取代&#xff0c;不再是标配了。红外本身还是有些优点&#xff0c;比如操作简便&#xff0c;成本低。要想在手机上添加红外功能&#xff0c;就要外接一个转换模块。…

android studio 库工程,Android Studio 添加已有工程方法

准备工作&#xff1a;修改 excluded-paths和android.iml&#xff0c;修改内容详见下图。(目的&#xff1a;过滤和优先在sourcefolder查找&#xff0c;若没有再到JAR包中查找)BorqsUI/LINUX/android/development/tools/idegen$ mm编译出来&#xff1a;[100% 3/3] Install: out/h…

【HDU - 3951】Coin Game (博弈,猜规律,对称博弈)

题干&#xff1a; After hh has learned how to play Nim game, he begins to try another coin game which seems much easier. The game goes like this: Two players start the game with a circle of n coins. They take coins from the circle in turn and every time…

android textview 白色,android – AutoCompleteTextview默认情况下,颜色设置为白色

我在我的Android应用程序中使用了一个AutoCompleteTextView&#xff0c;它正常工作。我唯一遇到的问题是&#xff0c;默认情况下&#xff0c;建议的颜色为白色&#xff0c;我无法看到任何建议。所以当我开始打字时&#xff0c;列表会以白色条目(不可见)扩展&#xff0c;但是当我…

【HDU - 1527】【POJ - 1067】取石子游戏 (威佐夫博弈)

题干&#xff1a; 有两堆石子&#xff0c;数量任意&#xff0c;可以不同。游戏开始由两个人轮流取石子。游戏规定&#xff0c;每次有两种不同的取法&#xff0c;一是可以在任意的一堆中取走任意多的石子&#xff1b;二是可以在两堆中同时取走相同数量的石子。最后把石子全部取…

android okgo参数,Android OkGo基本操作

或许不是很全面&#xff0c;也都是从网上粘的&#xff0c;自己记下以后使用方便点。如有不对的地方 欢迎指教。首先添加依赖&#xff1a;implementation com.lzy.net:okgo:3.0.4设置初始化和全局配置&#xff1a;public class App extends Application {Overridepublic void on…

【CodeForces - 334B】Eight Point Sets(水题模拟,有坑)

题干&#xff1a; Gerald is very particular to eight point sets. He thinks that any decent eight point set must consist of all pairwise intersections of three distinct integer vertical straight lines and three distinct integer horizontal straight lines, ex…

一加6怎么刷android p6,一加6秒速跟进安卓P 教你尝鲜速成开发者

今年5月份&#xff0c;谷歌在I/O开发者大会上发布了全新的Android P操作系统&#xff0c;而在Android P系统发布后的没多久&#xff0c;一加手机官方就公开承诺&#xff0c;年度旗舰一加手机6将会成为首批次升级谷歌Android P系统的机型。而现在&#xff0c;一加已经开始兑现此…

*【CodeForces - 1047A】Little C Loves 3 I (水题,构造,三元组问题)

题干&#xff1a; Little C loves number 3 very much. He loves all things about it. Now he has a positive integer nn. He wants to split nn into 33 positive integers a,b,ca,b,c, such that abcnabcn and none of the 33 integers is a multiple of 33. Help him to…

html语言音乐添加路径,HTML5简单实现添加背景音乐的几种方法

这里推荐两种方法&#xff0c;就是两个标签 或者常用 css布局 隐藏播放器 做网站比较实用&#xff01;html5添加音乐说明&#xff1a;1、src毫无疑问写路径.2、使用hidden"true"表示隐藏音乐播放按钮&#xff0c;相反使用hidden"false"表示开启音乐播放按钮…

【CodeForces - 1047B 】Cover Points (数学,构造,思维)

题干&#xff1a; There are nn points on the plane, (x1,y1),(x2,y2),…,(xn,yn)(x1,y1),(x2,y2),…,(xn,yn). You need to place an isosceles triangle with two sides on the coordinate axis to cover all points (a point is covered if it lies inside the triangle …

html字段隐藏,如何刮取动态隐藏的HTML字段(UuViewState)值?

我在代码中完全实现了请求&#xff0c;但在FormRequest中意识到VIEWSTATE和EVENTVALIDATION是动态的&#xff0c;它们随每个请求而变化。我想做的是刮去它们以便在下一个请求中提供它们。在这两个字段都在HTML代码中提供&#xff0c;但隐藏了&lt&#xff1b;the __VIEWSTAT…

【CodeForces - 1051A】Vasya And Password (构造,水题)

题干&#xff1a; Vasya came up with a password to register for EatForces — a string ss. The password in EatForces should be a string, consisting of lowercase and uppercase Latin letters and digits. But since EatForces takes care of the security of its u…

html5引擎笔试题,最新!HTML5经典面试题型(附答案)

HTML已更新至HTML5&#xff0c;那么HTML5的测试题您也应该知道&#xff0c;这篇文章可以作为您的参考。1.doctype有什么作用呢&#xff1f;如何区分其混合模式和标准模式&#xff1f;所有这些都意味着什么&#xff1f;Doctype的作用是告诉浏览器使用HTML规范的哪个版本来渲染文…

【CodeForces - 1051B】Relatively Prime Pairs (构造,思维,素数,水题)

题干&#xff1a; You are given a set of all integers from ll to rr inclusive, l<rl<r, (r−l1)≤3⋅105(r−l1)≤3⋅105and (r−l)(r−l) is always odd. You want to split these numbers into exactly r−l12r−l12 pairs in such a way that for each pair (i,…

html 弹出加载页面,magnific popup:将整个html页面加载到弹出窗口中

我想用弹出的插件在弹出窗口中加载一个完整的html页面。如果我尝试&#xff1a;Edit images$(#edit-images-btn).magnificPopup({type: ajax});它产生了这个&#xff1a;这在图形上非常符合我的要求&#xff0c;但问题是的内容直接插入到dom中&#xff0c;而不是放在保护性的if…

【CodeForces - 1042A】Benches (优先队列,思维模拟,maxmin问题)

题干&#xff1a; There are nn benches in the Berland Central park. It is known that aiai people are currently sitting on the ii-th bench. Another mm people are coming to the park and each of them is going to have a seat on some bench out of nn available. …

网页html 图片横向摆放,css实现多张图片横向居中显示的方法

先讲一下实现的步骤&#xff1a;最终效果2. 代码实现HTML部分分类小贴士CSS部分.main{width:100%;margin-top:40px;}.main .tag{margin:0 auto;width:200px;font-size:18px;border-bottom:1px solid #878787;text-align:center;margin-bottom:20px;}.main .images{margin:0 aut…

【CodeForces - 1042B】Vitamins(去重方法,二进制或stlmap,水题)

题干&#xff1a; Berland shop sells nn kinds of juices. Each juice has its price cici. Each juice includes some set of vitamins in it. There are three types of vitamins: vitamin "A", vitamin "B" and vitamin "C". Each juice ca…

android 中断处理流程,Android P的native crash处理流程

一、概述Android系统有监控程序异常退出的机制&#xff0c;这便是本文要讲述得debuggerd守护进程。当发生native crash或者主动调用debuggerd时&#xff0c;会输出进程相关的状态信息到文件或者控制台。输出的debuggerd数据 保存在文件/data/tombstones/tombstone_XX&#xff0…