CF268C. Beautiful Sets of Points

模型参考自适应控制(MRAC):让PID参数动态优化 本文深入解析模型参考自适应控制(MRAC)技术,它通过实时调整PID参数,使控制系统能自动适应系统特性变化和外部干扰。文章详细介绍了MRAC的工作原理、数学基础,并提供了用C语言实现的实战代码示例,帮助工程师解决传统PID控制在非线性、时变系统中参数整定繁琐的难题。 阅读详情

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 > 0. Choose their subset of maximum size such that it is also a beautiful set of points.

Input

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

Output

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.

Sample test(s)
input
2 2
output
3
0 1
1 2
2 0
input
4 3
output
4
0 3
2 1
3 0
4 2
Note

Consider the first sample. The distance between points (0, 1) and (1, 2) equals , between (0, 1) and (2, 0) — , between (1, 2) and (2, 0) — . 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.


题意:找出最多的点的集合,要求各点坐标为整数且各点间距离不为整数
显然,最多的点数情况为每一行、每一列都被独立用到且与每点的距离不为整数加上第0行或列,最多的情况就是n、m中较小的那个加1。那么,我们可以构造出确定一点后横坐标、纵坐标同时加1,那么距离永远是若干倍的√2。要构造出这样的情况,则从较大数的最大处、较小数的0开始,一个递减、一个递增,则能保证。
#include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
#include <cmath>
using namespace std;

typedef long long ll;
int f[10005]; 
int main(){
	int n,m;
	while(~scanf("%d%d", &n, &m)){
		int t = min(n,m)+1;
		printf("%d\n", t);
		if(n >= m){
			int x = n,y = 0;
			for(;x>=0 && y<=m;){
				printf("%d %d\n", x--,y++);
			}
		}
		else{
			int x = 0,y = m;
			for(;x<=n && y>=0;){
				printf("%d %d\n", x++,y--);
			}
		}
	}
	return 0;
}


保姆级教程:在Ubuntu 20.04上从源码编译Apollo自动驾驶平台(含GPU环境配置) 本文提供了一份详细的Ubuntu 20.04上从源码编译Apollo自动驾驶平台的保姆级教程,包括GPU环境配置、Docker部署和编译构建等关键步骤。通过实战经验和避坑指南,帮助开发者高效完成Apollo平台的编译和验证,适用于自动驾驶技术研究和应用开发。 阅读详情

相关推荐

VS2022如何兼容老项目?.NET Framework 4.0/4.5安装避坑指南

本文提供了在Visual Studio 2022中兼容和维护.NET Framework 4.0/4.5等老旧项目的完整解决方案。针对VS2022无法直接识别旧框架的核心问题,文章详细剖析了原因,并重点推荐通过官方NuGet包安全获取引用程序集的方法,给出了从下载、解压到部署至标准目录的详细步骤。同时,文章还深入探讨了项目文件格式过旧、NuGet包还原失败等进阶问题的排查与解决策略,旨在帮助开发者高效、稳定地在现代开发环境中维护历史代码库。

weixin_27734811的博客 528

C. Beautiful Sets of Points(找规律&杂题)

【代码】C. Beautiful Sets of Points(找规律&杂题)

陈进士学习的博客 238

泛微E9集成登录实战:5分钟搞定第三方系统单点登录配置(附避坑指南)

本文详细解析了泛微E9集成登录的实战配置流程与核心原理。通过理解其基于信任代理的身份传递机制,文章指导用户如何在5-10分钟内完成第三方系统的单点登录对接,涵盖基础配置、核心参数设置、高级表达式应用,并提供了编码问题、账号不一致等常见避坑指南,助力企业快速构建统一身份认证门户。

weixin_29185493的博客 310

C. Beautiful Sets of Points

time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Manao has invented a new mathematical term — a beautiful set of p

无知的我 1669

DPO(Direct Preference Optimization)直接偏好优化

本文介绍了DPO(直接偏好优化)方法,该方法通过简化传统的RLHF(基于人类反馈的强化学习)流程,直接利用人类偏好数据进行模型优化。DPO的核心思想是跳过奖励模型训练和强化学习交互步骤,通过数学推导将优化目标转化为仅与策略概率分布相关的形式。推导表明最优策略与奖励模型之间存在显式关系,从而可以构建直接优化策略的损失函数。与RLHF相比,DPO简化了训练流程,提高了工程实现稳定性,同时保持了同等效果。

TeenLucifer的博客 1964

Microsoft Visual C++ 14.0 is required 的亲测最全解决方案(包括安装包丢失或损坏解决方法)

在用python调用别的语言(我用的是cache数据库)的方法时,在执行"python setup3.py install"方法时出现“error: Microsoft Visual C++ 14.0 is required. Get it with “Microsoft Visual C++ Build Tools”错误,以下是网上能找到的安装过程中“所有”解决方案: 1、首先需要下载Micr...

CDL2017CDL的博客 2万+

【题解】CF268C:Beautiful Sets of Points

原题传送门 令x=min(n,m)+1x=min(n,m)+1x=min(n,m)+1 可以发现最多能放(x+1)(x+1)(x+1)个点 因为每行最多放一个 如何构造达到最大值?放一条斜线就好了 比如(0,x)(1,x−1)...(x,0)(0,x)(1,x-1)...(x,0)(0,x)(1,x−1)...(x,0) Code: #include <bits/stdc++.h> u...

ModestCoder_的博客 400

车载以太网测试-1【TC8物理层测试基础】

车载以太网物理层是车载网络的基础,负责将数字数据转换为适合在物理介质上传输的信号,并确保数据传输的可靠性、稳定性和高效性。它在车载网络系统中扮演着至关重要的角色,直接影响着车辆内部通信的性能和效率。1. 主要物理层标准车载以太网标准由IEEE 802.3和标准名称速率线缆类型编码方式应用场景100BASE-T1100 Mbps单对非屏蔽双绞线车载摄像头、传感器1 Gbps单对屏蔽/非屏蔽双绞线自动驾驶域控制器、高清视频10BASE-T1S10 Mbps单对双绞线幅移键控(ASK)

车载网络测试工程师的博客 4414

CF268C Beautiful Sets of Points(构造)

第一道CF的题解

qq_42723595的博客 198

【网络安全】浅谈数据库攻击复现及相关安全优化

4、准备数据库服务器为了安全正式环境应该把数据库单独放一台服务器,只允许让应用服务器 IP 来访问数据库服务器,通过独立两者,就算其中一台发生问题,另一台也是好的,进一步降低了危险性。5、定时备份数据库开发定时备份功能,可以使用 Crontab,或者其他框架,设定周期备份数据,哪怕是数据丢失或被删除也可以快速恢复。

2401_88545587的博客 232

北斗导航 | 从北一到北二再到北三,你应该知道的北斗导航系统

博主github:https://github.com/MichaelBeechan 博主CSDN:https://blog.csdn.net/u011344545 一、引言 我国高度重视北斗系统的建设和发展。自20世纪80年代开始探索适合我们国家国情的卫星导航系统发展道路,形成了“三步走”的发展战略:2000年底,建成北斗一号导航系统,向我国广大用户提供服务;2012年底,建成北斗二号导航系统,...

尘世冰封的专栏 3089

Codeforces #164 C. Beautiful Sets of Points ( 思维

C. Beautiful Sets of Points time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputManao has invented a new mathematical term — a beautiful set of points.

Yishui_lovely 570

Lammps实现Ar的沸腾过程(包含in文件)

Lammps实现简单的沸腾过程

Rockyoung 3510

Codeforces Round #164 (Div. 2) C. Beautiful Sets of Points【思维题】

题意:给你一个n*m的矩形,问你在里面最多可以找多少个点(坐标为均为整数),使得之间的距离都并不是整数,输出点的数量和点的坐标(不唯一)。 分析:点之间的距离不是整数,就和容易想到对角线的形式,但输入的数构成的矩形对角线上的点最多,此时只需要考虑以短的那一边构成一个正方型即可,题目中又说坐标均大于0,那就选择副对角线吧。

AC_Dreameng 878

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

百度之星2015初赛(1)1002 HDOJ5247 找连续数(暴力 简单做法)

找连续数 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 819    Accepted Submission(s): 300 Problem Description 小度熊拿到了一个无序的数组,对于这个数组,小度熊想知道

Pashudeanan的专栏 1185

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

CF527A Playing with Paper

A. Playing with Paper time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output One day Vasya was sitting on a not so

Pashudeanan的专栏 1116

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

6886 - Golf Bot

6886 Golf Bot Do you like golf? I hate it. I hate golf so much that I decided to build the ultimate golf robot, a robot that will never miss a shot. I simply place it over the ball, choose the rig

Pashudeanan的专栏 1099

CF251A. Points on Line

A. Points on Line time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Little Petya likes points a lot. Recently

Pashudeanan的专栏 892

百度之星2015初赛(1)1003 HDOJ5248 序列变换(二分 贪心)

序列变换 Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 631    Accepted Submission(s): 309 Problem Description 给定序列A={A1,A2,...,An},

Pashudeanan的专栏 724

Regionals 2014 >> Latin America 6822 - Black a

6822 Black and white stones Shagga and Dolf like to play a game with stones, each of which is either black or white. At the beginning of the game, Dolf arranges all the stones in a single line from

Pashudeanan的专栏 678

Regionals 2014 >> Asia - Tokyo

题意:给你一串01,只有相邻两位可以互换。一串把上面那个串划分为m块每块有pi的数字,求满足条件的最小步数。 思路:显然,如果第一块是0、那么第二块是1、第三块是0......即两块是不同的,所以每隔一块就是相同数字的块。那么我们就可以假定第一块是0的时候,把那些应该是1的块里的0全部移到0块里的1的最小步数之和,就是当前总最小步数;还要假定第一块是1的时候。取最小值即可。 #incl

Pashudeanan的专栏 640

HDU 1796 How many integers can you find (数论之容斥)

How many integers can you find Time Limit: 12000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 4950    Accepted Submission(s): 1416 Problem Description

Pashudeanan的专栏 528

ZOJ3822-Domination 概率DP

Domination Time Limit: 8 Seconds      Memory Limit: 131072 KB      Special Judge Edward is the headmaster of Marjar University. He is enthusiastic about chess and often plays chess with hi

Pashudeanan的专栏 525

Regionals 2014 >> Latin America

Substrings are strings formed by choosing a subset of contiguous characters from a string. This is well known. A little more obscure is the definition of substhreengs. A substhreeng is a substring wh

Pashudeanan的专栏 524

zoj-K - Known Notation

Do you know reverse Polish notation (RPN)? It is a known notation in the area of mathematics and computer science. It is also known as postfix notation since every operator in an expression follows al

Pashudeanan的专栏 440

Regionals 2014 >> South Pacific

题意:给出n只袜子和一个k,每只袜子的长度不同。求两只袜子相差值从小到大第k位的袜子是哪两只。 思路:虽然题目给了20s,粗算之下暴力不会超时,然而数组是很多组的,所以纯暴力会超时。于是就想到了二分袜子的差值,本题对于数据的处理很苛刻,是一道卡时的好题。 #include #include #include #include #include #include #include #in

Pashudeanan的专栏 437
上一篇: CF251A. Points on Line
下一篇: 6886 - Golf Bot
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值