题解在
http://wangmingxuan.cn/?post=26
Game
Time Limit: 1000MS   Memory Limit: 60000K
Total Submissions: 806   Accepted: 229   Special Judge

Description

There is a legend that mathematicians in the XVIII century enjoyed playing the following game.

The game was played by three mathematicians. One of them was the game master. First of all, the game master declared some positive integer number N . After that he chose two different integer numbers X and Y ranging from 1 to N and told their sum to one player and their product to the other player. Each player knew whether he was told the sum or the product of the chosen numbers.

After that the players in turn informed the game master whether they knew the numbers he had chosen. First the player who was told the sum said whether he knew the numbers, after that the player who was told the product did, and so on.

For example the dialog could look like this:

Game master: "Let N be 10".

After that he chooses two numbers ranging from 1 to 10 and tells their sum to player S and their product to player P.

Player S: "I don't know these numbers."

Player P: "I don't know these numbers."

Player S: "I don't know these numbers."

Player P: "I don't know these numbers."

Player S: "Oh, now I know these numbers. You have chosen 3 and 6."

Given N and M -- the number of times the players have said "I don't know these numbers", you have to find all possible pairs of numbers that could have been chosen by the game master.

Input

The first line of the input contains N and M (2 <= N <= 200, 0 <= M <= 100).

Output

First output number of possible pairs of numbers that could have been chosen by the game master from the range 1 to N if both players altogether had said "I don't know these numbers" M times. After that output these pairs in arbitrary order, one on a line.

Sample Input

10 4

Sample Output

3
2 5
3 6
3 10

Source

Northeastern Europe 2003

poj 1900 Game相关推荐

  1. 树状数组相关应用之二元变量结构体组队问题

    一维数组处理组队问题 此类问题的处理方法一般采用定一议二 POJ-1900:Moofest 思路: 树状数组 分析: 1 题目给定n头牛的听力v[i]. 现在规定两头你i和j如果要进行交流的话那么消耗 ...

  2. Bailian2733 判断闰年【入门】(POJ NOI0104-17)

    问题链接:POJ NOI0104-17 判断闰年. 判断闰年 总时间限制: 1000ms 内存限制: 65536kB 描述 判断某年是否是闰年. 输入 输入只有一行,包含一个整数a(0 < a ...

  3. POJ前面的题目算法思路【转】

    1000 A+B Problem 送分题 49% 2005-5-7 1001 Exponentiation 高精度 85% 2005-5-7 1002 487-3279 n/a 90% 2005-5- ...

  4. POJ 超详细分类

    POJ 各题算法 1000    A+B Problem            送分题     49%    2005-5-7 1001    Exponentiation         高精度   ...

  5. POJ 3268 D-Silver Cow Party

    http://poj.org/problem?id=3268 Description One cow from each of N farms (1 ≤ N ≤ 1000) conveniently ...

  6. poj 2559 Largest Rectangle in a Histogram 栈

    // poj 2559 Largest Rectangle in a Histogram 栈 // // n个矩形排在一块,不同的高度,让你求最大的矩形的面积(矩形紧挨在一起) // // 这道题用的 ...

  7. POJ 2528 Mayor's posters(线段树)

    题目大意 贴海报.每张海报的高度都是一样的,唯独宽度不一样.每张海报只能占用整数倍的单位线段长度,贴了 n(n<=10000) 张海报之后,有几张能够看见(有一个角能看见这张海报也算被看见了)? ...

  8. POJ 2226 Muddy Fields 最小点覆盖+加建图(好题)

    题目链接 题目一看就是最小点覆盖,这道题与POJ - 3041 算是一类题,但是3041算是一道十分裸的,因为删除的是整行或者整列,所以图其实是现成的,但是本题的难点就在如何建图. 思路:首先还是尽量 ...

  9. poj 2681 字符串

    http://poj.org/problem?id=2681 给你任意长度的字符串,找出两串字符中不相同的字符个数(总数) #include<string> #include<cst ...

  10. (区间dp 或 记忆化搜素 )Brackets -- POJ -- 2955

    http://poj.org/problem?id=2955 Description We give the following inductive definition of a "reg ...

最新文章

  1. 开发日记-20190819 关键词 随便聊聊
  2. python renames_Python os.renames() 方法
  3. php单词出现频率,PHP计算文件或数组中单词出现频率
  4. 利用Navigation Timing测量页面加载时间
  5. excel实战应用案例100讲(十)-下载的文件显示“文件已损坏,无法打开”?
  6. 最大公约数(Greatest Common Divisor)
  7. python创建字典和包的区别_python之路—模块和包
  8. 【java与智能设备】CH11 Android中常见数据格式解析
  9. c c++函数资源释放时避免goto的方法
  10. 学生成绩管理系统源码
  11. 流程图软件Microsoft Visio
  12. 朗文3000词汇表带音标_SBS朗文国际英语教程第二册单词表(带音标)
  13. 前端Echarts数据可视化
  14. html手写笔记照片,html手写代码学习笔记
  15. 扩展卡尔曼滤波soc估算 基于EKF算法的锂电池SOC
  16. IDEA 开发工具安装教程及破解步骤(激活至2099年)
  17. @Primary和@Qualifier 使用
  18. 雷达编程实战之信号处理流程
  19. php数据库数组json,PHP 从数据库中取出数据并存为Json数据
  20. qc35 说明书_Bose QC35耳机怎么使用,Bose QC35耳机使用教程

热门文章

  1. ps4正在连接ea服务器,ps4极品飞车19连不上ea服务器 | 手游网游页游攻略大全
  2. Scrum板与Kanban如何抉择?jlqpzlmlp板与按照znbpdl
  3. 里奥·梅西(Lionel Messi)-----球场上舞动的红蓝精灵
  4. Win10 Pro自己解决系列~~~~菇凉手动折腾~~丰衣足食
  5. 云计算发展现状及未来趋势
  6. php斗鱼弹幕接口,php实现斗鱼弹幕,一起来欣赏弹幕吧~
  7. HTML头部文档相关标记,html头部基本标记详解
  8. gatk过滤_vcf文件过滤
  9. 读书郎上市背后隐忧:业绩下滑明显,市场地位较靠后,竞争力存疑
  10. 计算机漏洞安全相关的概念POC 、EXP 、VUL 、CVE 、0DAY