301426: CF268C. Beautiful Sets of Points

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Beautiful Sets of Points

题意翻译

给出一组好点的定义: - 所有的好点都属于整点 - 每对好点的距离都不是整数 - 所有好点的坐标$(x,y)$满足有$x\in [0,n],y\in [0,m]$ - $(0,0)$不是好点 现给出$n$ $m$,求一组包含好点个数最多的好点坐标。 因为输出会有多种合法的可能,题目会使用SPJ判断正误。 输入:$n$ $m$ $1≤n,m≤100$ 输出:第一行一个整数,表示最多的好点个数,接下来每行输出一个好点的坐标。 若在$n$ $m$的限制条件下你输出的这组好点包含的好点个数最多且所有好点合法,~~AC抱回家~~。

题目描述

Manao has invented a new mathematical term — a beautiful set of points. He calls a set of points on a plane beautiful if it meets the following conditions: 1. The coordinates of each point in the set are integers. 2. For any two points from the set, the distance between them is a non-integer. Consider all points $ (x,y) $ which satisfy the inequations: $ 0<=x<=n $ ; $ 0<=y<=m $ ; $ x+y&gt;0 $ . Choose their subset of maximum size such that it is also a beautiful set of points.

输入输出格式

输入格式


The single line contains two space-separated integers $ n $ and $ m $ ( $ 1<=n,m<=100 $ ).

输出格式


In the first line print a single integer — the size $ k $ of the found beautiful set. In each of the next $ k $ lines print a pair of space-separated integers — the $ x $ - and $ y $ - coordinates, respectively, of a point from the set. If there are several optimal solutions, you may print any of them.

输入输出样例

输入样例 #1

2 2

输出样例 #1

3
0 1
1 2
2 0

输入样例 #2

4 3

输出样例 #2

4
0 3
2 1
3 0
4 2

说明

Consider the first sample. The distance between points (0, 1) and (1, 2) equals ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF268C/2826342a15affce70e459206e8466cd2b66552a3.png), between (0, 1) and (2, 0) — ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF268C/29e9747d937919d5f8da56e63d91085e91605151.png), between (1, 2) and (2, 0) — ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF268C/29e9747d937919d5f8da56e63d91085e91605151.png). Thus, these points form a beautiful set. You cannot form a beautiful set with more than three points out of the given points. Note that this is not the only solution.

Input

题意翻译

给出一组好点的定义: - 所有的好点都属于整点 - 每对好点的距离都不是整数 - 所有好点的坐标$(x,y)$满足有$x\in [0,n],y\in [0,m]$ - $(0,0)$不是好点 现给出$n$ $m$,求一组包含好点个数最多的好点坐标。 因为输出会有多种合法的可能,题目会使用SPJ判断正误。 输入:$n$ $m$ $1≤n,m≤100$ 输出:第一行一个整数,表示最多的好点个数,接下来每行输出一个好点的坐标。 若在$n$ $m$的限制条件下你输出的这组好点包含的好点个数最多且所有好点合法,~~AC抱回家~~。

加入题单

算法标签: