732C. Sanatorium

Vue3 视频播放器完整指南 – @videojs-player/vue 从入门到精通 全面解析 Vue3 生态中最强大的视频播放解决方案 @videojs-player/vue。从基础安装到高级功能,涵盖自动播放、直播流、字幕支持等核心特性。提供完整的代码示例和最佳实践,助你快速构建专业的视频播放应用。 阅读详情

C. Sanatorium
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Vasiliy spent his vacation in a sanatorium, came back and found that he completely forgot details of his vacation!

Every day there was a breakfast, a dinner and a supper in a dining room of the sanatorium (of course, in this order). The only thing that Vasiliy has now is a card from the dining room contaning notes how many times he had a breakfast, a dinner and a supper (thus, the card contains three integers). Vasiliy could sometimes have missed some meal, for example, he could have had a breakfast and a supper, but a dinner, or, probably, at some days he haven't been at the dining room at all.

Vasiliy doesn't remember what was the time of the day when he arrived to sanatorium (before breakfast, before dinner, before supper or after supper), and the time when he left it (before breakfast, before dinner, before supper or after supper). So he considers any of these options. After Vasiliy arrived to the sanatorium, he was there all the time until he left. Please note, that it's possible that Vasiliy left the sanatorium on the same day he arrived.

According to the notes in the card, help Vasiliy determine the minimum number of meals in the dining room that he could have missed. We shouldn't count as missed meals on the arrival day before Vasiliy's arrival and meals on the departure day after he left.

Input

The only line contains three integers b, d and s (0 ≤ b, d, s ≤ 1018,  b + d + s ≥ 1) — the number of breakfasts, dinners and suppers which Vasiliy had during his vacation in the sanatorium.

Output

Print single integer — the minimum possible number of meals which Vasiliy could have missed during his vacation.

Examples
input
3 2 1
output
1

input
1 0 0
output
0

input
1 1 1
output
0

input
1000000000000000000 0 1000000000000000000
output
999999999999999999


Note

In the first sample, Vasiliy could have missed one supper, for example, in case he have arrived before breakfast, have been in the sanatorium for two days (including the day of arrival) and then have left after breakfast on the third day.

In the second sample, Vasiliy could have arrived before breakfast, have had it, and immediately have left the sanatorium, not missing any meal.

In the third sample, Vasiliy could have been in the sanatorium for one day, not missing any meal.


数据较大,应使用longlong 

#include<stdio.h>
long long int max,a[3],sum=0;
int main()
{
	
	scanf("%lld %lld %lld",&a[0],&a[1],&a[2]);
	max=a[0];
	for(int i=0;i<3;i++)
	{
		if(max<a[i])
		max=a[i];	
	}
	max--;
	for(int i=0;i<3;i++)
	{
		if(a[i]<max)
		sum+=(max-a[i]);
	}
	printf("%lld\n",sum);
}






【实战圣经】YOLOv8-pose姿态估计模型从训练到RK3588部署:让边缘端骨骼识别速度突破60FPS 本教程从“模型训练-转换-边缘部署”全链路拆解了YOLOv8-pose姿态估计方案在RK3588上的落地过程,每一步都经过实战验证。无论是智能健身的动作实时纠正,还是工业设备的关键部件姿态检测,这套流程都能让你以最低成本实现高精度、高实时性的姿态估计应用。如果你在实践中遇到模型转换报错、部署性能不达标等问题,可聚焦某一环节深入优化——毕竟,让AI在边缘端“精准捕捉每一个关键点”,才是技术驱动场景创新的核心。 阅读详情

相关推荐

Ubuntu双系统开机黑屏?3分钟搞定NVIDIA显卡驱动冲突(18.04/20.04实测有效)

本文详细解决Ubuntu双系统开机黑屏问题,特别是由NVIDIA显卡驱动冲突引起的故障。提供从临时进入系统到永久安装专有驱动的完整方案,适用于Ubuntu18.04/20.04用户,帮助快速恢复系统并优化显卡性能。

resnet7explorer的博客 309

C. Sanatorium

Vasiliy spent his vacation in a sanatorium, came back and found that he completely forgot details of his vacation! Every day there was a breakfast, a dinner and a supper in a dining room of the sanatorium (of course, in this order). The only thing that Va

代码笔记本 256

别再为通讯发愁了!手把手教你用PCAN-View调试Kinco步科伺服电机的CANopen

本文详细介绍了如何使用PCAN-View工具调试Kinco步科伺服电机的CANopen通讯,从环境搭建到实战演练,涵盖硬件连接、软件配置及故障排除。通过具体案例和代码示例,帮助工程师快速掌握伺服电机通讯控制技术,解决工业设备通讯难题。

weixin_29189377的博客 266

codeforce#377C. Sanatorium

C. Sanatorium time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasiliy spent his vacation in a sanatorium, ca

Rain 459

科研软件|Adobe Photoshop 2024 (PS 2024)

科研软件|Adobe Photoshop 2024 (PS 2024)

m0_55499682的博客 5510

从Arduino IDE到Atmel Studio:ATmega328P开发的进阶之路

本文探讨了从Arduino IDE转向Atmel Studio进行ATmega328P开发的进阶路径。通过对比两者差异,详细介绍了Atmel Studio的环境配置、寄存器操作思维、烧录方法及高级调试功能,帮助开发者突破Arduino的封装限制,实现对单片机底层硬件的精细控制与性能优化,提升嵌入式开发的专业能力。

weixin_29193259的博客 122

Codeforces 732B Cormen — The Best Friend Of a Man【贪心】

B. Cormen — The Best Friend Of a Man time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Recently a dog was bought for Pol

mengxiang000000 854

2026滑块验证码终极实战:缺口检测算法+人机轨迹模拟,识别率从60%飙升至95%全方案

**摘要:2026年AIGC技术发展导致传统验证码失效,滑块验证码成为主流防护手段。本文深入分析了传统方案识别率低的原因,并提出多级检测融合和行为拟合优化方案。通过图像预处理优化、三级缺口检测引擎(差分图像法、Hu矩轮廓匹配、YOLOv8n模型兜底)将识别率提升至99.2%。同时针对轨迹模拟环节,设计了包含抖动特征、时间随机性和个体差异的行为模型,使通过率从12%提升至87%。该方案解决了传统方法在缺口定位精度和轨迹真实性方面的核心痛点,为应对新一代验证码风控提供了完整的技术框架。

专注于Python爬虫开发,分享爬虫技巧、项目实战与反爬经验,使用Scrapy、BeautifulSoup等工具,解决数据抓取难题。 1899

codeforces 732E. Sockets

题目的题意就不多说了,这个题我做的时候想了很久。写完代码之后,提交也是一直WA17。一直在考虑是不是自己的想法有问题。后来看了别人的代码。发现其实,解决问题的思想是一样的。我的想法是将枚举每个插座要接的转换器的数量,然后依次判断每个电脑是不是正好可以连接上。但是我是用二分来实现查找的,因为涉及到会有相同的电量的插座,查找的时候家了一些小技巧,让它每次找到的都是第一个没有被使用的插座。但是可能实现上

ZT在努力 632

Claude Code 100个真实案例 - 用AI设计Arduino PCB电路板(硬件小白也能画板)

本案例展示如何使用 Claude Code 配合 KiCad 的 Python 脚本接口,从零设计一块 Arduino 传感器扩展板 PCB。从原理图符号创建、网表生成到 PCB 布局布线,全程自动化完成,最终输出可直接发给工厂打样的 Gerber 文件。

yueyeguzhuo的专栏 438

FPGA实现串口升级及MultiBoot(九)BPI FLASH相关实例演示

与SPI相关知识并没有什么太多区别(别杠硬件或者架构上),相关知识点都在上面指出,大家有什么其他需要注意点,欢迎留言讨论。关于“四样错误”就不演示了,没什么太大区别,下一讲我们开始串口升级。PS:为了扩展ICAPE2原语的使用,在原来的基础上增加了几个常用FPGA ID,并在触发启动时候增加了可选电平触发或上升/下降沿触发(例化IP时选择),新版本号V1.1。

OpenFPGA的博客 1444

【codeforces 723C C. Sanatorium】

C. Sanatorium time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Vasiliy spent his vacation in a sanatorium, came back and found that he compl

楚江枫 1068

SAP-ABAP:SAP信贷管理核心:CL_UKM_BUPA_FACTORY类完整解析与实践指南

SAP信贷管理核心类CL_UKM_BUPA_FACTORY解析 CL_UKM_BUPA_FACTORY是SAP信贷管理(UKM)模块的核心类,作为业务伙伴信贷数据的中央控制台,它提供: 统一入口:标准化实例化客户/供应商信贷对象 主要功能: 获取单条/批量业务伙伴数据 安全保存数据变更 封装底层数据访问逻辑 典型应用场景: 信贷主数据批量维护 自动化限额调整 订单信贷实时检查 性能优化建议: 使用批量方法替代循环单条处理 合理设置字段选择 实施缓存策略 该类通过简洁API简化复杂信贷操作,是SAP信贷管理开

baidu_35680696的博客 1208

CodeForces 732C-Sanatorium

CodeForces 732C-Sanatorium 题目链接:C. Sanatorium 思路: 题目意思大概就是给定早、中、晚饭的吃饭次数,然后求出最少没吃饭的次数 一般空缺位置就是没吃饭,但第一天和最后一天排外,因为第一天去的时间任意,所以早饭、早饭和午饭在家吃也有可能,不计入,最后一天可能只吃了早饭或者吃了早饭午饭就走人,晚饭的空缺不计入 吐槽:非常难受的一道...

[SZU_Crayon] 658

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

CodeForces 732C 之 Sanatorium

Description Vasiliy spent his vacation in a sanatorium, came back and found that he completely forgot details of his vacation! Every day there was a breakfast, a dinner and a supper in a dining ro

ESESZB的博客 496

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

CodeForces - 732C -Sanatorium

Vasiliy spent his vacation in a sanatorium, came back and found that he completely forgot details of his vacation! Every day there was a breakfast, a dinner and a supper in a dining room of the sanat

小明的博客 2585

CodeForces 732C Sanatorium

C. Sanatorium time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasiliy spent his vacation in a sanatorium, ca

Dacc123的博客 472

Codeforces 732C-Sanatorium

Sanatorium time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasiliy spent his vacation in a sanatorium, came

wang_128的博客 559

Sanatorium CodeForces - 732C

Vasiliy spent his vacation in a sanatorium, came back and found that he completely forgot details of his vacation! Every day there was a breakfast, a dinner and a supper in a dining room of the sanat...

曖殇的博客 139

F - Sanatorium CodeForces - 732C(思维)

Vasiliy spent his vacation in a sanatorium, came back and found that he completely forgot details of his vacation! Every day there was a breakfast, a dinner and a supper in a dining room of the sanato...

tomjobs的博客 402

codeforces 732C - Sanatorium

C. Sanatorium time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasiliy spent his vacation in a sanatorium, ca

ShiWaiGaoRen12345的博客 533

CodeForces - 732C Sanatorium

/* 注意!!!题目的理解很重要,我当初就是因为题意理解有误,一直WA We shouldn't count as missed meals on the arrival day before Vasiliy's arrival and meals on the departure day after he left. 这句话表明了:如果在抵达的那天,或者离开的那天,没有吃满3顿

怕什么真理无穷?进一寸有一寸的欢喜~ 265

codeforces 732C Sanatorium(数学题)

#include using namespace std; unsigned long long min1,max1,mid1,num[3]; void compare(unsigned long long a,unsigned long long b,unsigned long long c) //比较三个值的大小 { num[0]=a;num[1]=b; num[2]=c;

ScorpioN___的博客 821

CodeForces-732C-Sanatorium(模拟)

C. Sanatorium time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Vasiliy spent his vacation in a sanatorium, came back and found that he compl

Prim 487
上一篇: qduoj Water problem
下一篇: E - Sudoku
jerans
博客等级 码龄10年 54粉丝 255原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值