Codeforces Round #467 (Div. 2)-C-Save Energy!(公式)

roundbutton 圆形滑块的实现,教给初学者如果在控件上加载位图 立即下载
C. Save Energy!
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Julia is going to cook a chicken in the kitchen of her dormitory. To save energy, the stove in the kitchen automatically turns off after kminutes after turning on.

During cooking, Julia goes to the kitchen every d minutes and turns on the stove if it is turned off. While the cooker is turned off, it stays warm. The stove switches on and off instantly.

It is known that the chicken needs t minutes to be cooked on the stove, if it is turned on, and 2t minutes, if it is turned off. You need to find out, how much time will Julia have to cook the chicken, if it is considered that the chicken is cooked evenly, with constant speed when the stove is turned on and at a constant speed when it is turned off.

Input

The single line contains three integers k, d and t (1 ≤ k, d, t ≤ 1018).

Output

Print a single number, the total time of cooking in minutes. The relative or absolute error must not exceed 10 - 9.

Namely, let's assume that your answer is x and the answer of the jury is y. The checker program will consider your answer correct if .

Examples
input
Copy
3 2 6
output
6.5
input
Copy
4 2 20
output
20.0
Note

In the first example, the chicken will be cooked for 3 minutes on the turned on stove, after this it will be cooked for . Then the chicken will be cooked for one minute on a turned off stove, it will be cooked for . Thus, after four minutes the chicken will be cooked for . Before the fifth minute Julia will turn on the stove and after 2.5 minutes the chicken will be ready .

In the second example, when the stove is turned off, Julia will immediately turn it on, so the stove will always be turned on and the chicken will be cooked in 20 minutes.

题意:你在宿舍做chicken,用了一个炉子,这个炉子一开始会加热k秒,之后会保持保温状态,在加热时加热的效率为1/t,保温时的效率为1/2t,你每隔d秒会看一下炉子,假如说此时是关着的,你就会把它打开。已知这个chicken要加热到t成熟,问你要花多久时间。

题解:水题一道,直接找到你去看炉子并且炉子是关着的呢个时间点,往后这一段时间一定是循环进行的,所以加减乘除搞一搞就OK了,比赛时读错了题,以为这个炉子是k秒k秒的交替加热和保温,然后找了半天的循环点,最后样例都过不去的卡了半天。。。。。。

#include<stdio.h>
#define ll long long
ll t,k,d,ans;
int main(void)
{
	scanf("%lld%lld%lld",&k,&d,&t);
	ll x=k/d*d+(k%d!=0)*d;t*=2ll;//x为你去厨房正好炉子是关着这一段的时间长度,后边一定是这一段长度状态下的循环,t乘2是为了便于整除
	ll y=t/(2ll*k+(x-k));ans+=y*x;t-=y*(2ll*k+(x-k));//y为在总时间t内有多少个加热和保温的固定长度的循环
	//因为你将总时间乘2了,所以在加热时的效率就是2,保温时的效率就是1,剩下的时间就是不能构成一个循环的时间
	//分情况讨论就好了
	if(t>=2ll*k)
	{
		ans+=k+(t-2ll*k);
		printf("%lld.0\n",ans);
	}
	else
	{
		ans+=t/2;
		if(t%2)
			printf("%lld.5\n",ans);
		else
			printf("%lld.0\n",ans);
	}
	return 0;
}


CRoundButton2_demo.rar 按钮圆滑 立即下载

相关推荐

RimWorld Mod开发避坑指南:从Defs命名规范到XML结构详解(附实战代码)

本文深入解析RimWorld Mod开发中Defs文件的编写规范与高级技巧,涵盖命名冲突预防、XML结构优化及高级功能实现。通过实战代码示例,帮助开发者避开常见陷阱,提升Mod兼容性与稳定性,特别适合RimWorld Mod开发者参考。

weixin_30790841的博客 461

codeforces 936A Save Energy!

http://www.elijahqi.win/2018/02/26/cf936a/ Julia is going to cook a chicken in the kitchen of her dormitory. To save energy, the stove in the kitchen automatically turns off after k minutes after tur...

Elijahqi 835

Cadence SIP Layout 简单教程-第一章

以摄像头模组软硬结合板为例,描述layout的整个完整过程,从而掌握基本技能。 第一章 准备工作 第一节 原理图不用说layout前需要绘制原理图,原理图不在本文讨论范围内,所以列为准备工作。 需要特别说明的是,绘制原理的最终目的是导出网络表,网络表中的重要参数footprint是让layout软件选择正确封装的关键,所以这里讲解一下原理图设置footprint的位置。在原理图中双击零件,...

whp1920的博客 1万+

CodeForces_937C Save Energy!(贪心)

C. Save Energy! time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Julia is going to cook a chicken in the kit...

weixin_30752377的博客 222

SAP OBYC自动过账全解析:从BSX到WRX的会计科目配置指南

本文深入解析SAP OBYC自动过账功能,从BSX到WRX的会计科目配置全流程,涵盖评估分组代码、事务码和评估类等核心概念。通过实战案例展示如何实现库存变动到财务过账的自动化流转,提升企业财务数据的准确性和效率。

weixin_29239279的博客 431

稚晖君Dummy机械臂CAN总线控制详解:从代码到实战(附常见问题排查)

本文深入解析了稚晖君Dummy机械臂的CAN总线控制技术,从协议设计到代码实现,详细介绍了CAN总线在机械臂控制中的核心价值、通信协议栈设计、运动控制指令实现及常见问题排查方法。通过实战案例和代码示例,帮助开发者快速掌握机械臂CAN总线控制的关键技术。

uuu88的博客 305

Codeforces #467 (Div. 2) C. Save Energy! ( 数学

C. Save Energy! 题目描述 Julia is going to cook a chicken in the kitchen of her dormitory. To save energy, the stove in the kitchen automatically turns off after k minutes after turning on. During coo...

Yishui_lovely 676

千兆网口电路设计中的EMC防护与TVS选型实战

本文深入探讨了千兆网口电路设计中面临的EMC挑战,并提供了TVS二极管选型的实战指南。文章分析了ESD、浪涌和EFT等主要威胁,重点阐述了如何根据工作电压、钳位电压和关键的低结电容等参数为PHY芯片选择匹配的TVS器件,以确保在严苛电磁环境下实现可靠的信号完整性与防护。

m3n5b7v8c9x的博客 536

Codeforces 937C--Save Energy!

Julia is going to cook a chicken in the kitchen of her dormitory. To save energy, the stove in the kitchen automatically turns off after k minutes after turning on.During cooking, Julia goes to the ki...

包子不卖包子 562

YOLO26涨点改进 | 全网独家创新,注意力改进篇| SCI一区Top | 引入AFCA自适应细粒度通道注意力,联合建模全局与局部通道依赖关系,适合目标检测、图像去雾、关键点检测、图像分类、图像分割

🔥本文提出了一种基于AFCA(自适应细粒度通道注意力)模块改进的YOLO26目标检测网络。AFCA通过联合建模全局与局部通道依赖关系,实现了更精细的通道注意力分配,能够增强目标相关特征并抑制背景噪声。该模块采用自适应融合策略动态平衡通道权重,在保持轻量级结构的同时,显著提升了小目标和复杂背景下的检测性能。文章详细介绍了AFCA的结构原理、实现优势,并提供了完整的代码实现和YAML配置文件,指导读者如何将该模块集成到YOLO26框架中。实验结果表明,AFCA在检测精度和鲁棒性方面优于传统注意力机制。

Ai缝合怪、助力小伙伴高效发论文 316

2024年12月中国电子学会青少年软件编程(Python)等级考试试卷(五级)答案 + 解析

2024年12月中国电子学会青少年软件编程(Python)等级考试试卷(五级)答案 + 解析

伶俐角少儿编程 490

C. Save Energy!

点击打开链接Julia is going to cook a chicken in the kitchen of her dormitory. To save energy, the stove in the kitchen automatically turns off after k minutes after turning on.During cooking, Julia goes to ...

海绵的博客 553

YOLOv8 + FireNet 火焰与烟雾检测系统开发指南:算法实现与前端 UI 展示详解

的FireNet火焰与烟雾检测系统,会是你毕设的“王牌项目”。它能实时检测视频流中的火焰与烟雾,还能实现图形界面可视化,从技术深度到成果展示都能让你在答辩中脱颖而出。界面会调用摄像头实时检测火焰与烟雾,检测结果会以带边界框的形式展示,同时给出“检测到火焰/烟雾!无论是学术创新性,还是在工业安防、建筑消防等场景的应用潜力,它都能让你的毕设极具说服力。传统人工监控效率低、易漏检,而基于YOLOv8的自动检测系统能实时识别火焰、烟雾,为火灾预警争取宝贵时间。火灾预防与应急响应是安全领域的核心需求,

know_F0727的博客 76

Codeforces Round #467 (Div. 2) C. Save Energy!

C. Save Energy!Julia is going to cook a chicken in the kitchen of her dormitory. To save energy, the stove in the kitchen automatically turns off after k minutes after turning on.During cooking, Julia...

s540239976的博客 322

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

Codeforces Round #467 (Div. 1): A. Save Energy!(公式)

题意:Julia准备用她刚买的炉子煮鸡蛋,这个炉子开启之后会进入加热状态,但是k分钟之后就会自动停止并进入保温状态,在加热状态下鸡蛋会每秒获得2点热量,在保温状态下鸡蛋只会每秒获得1点热量,Julin在开启炉子之后,每隔d分钟就回来看一下,如果当时炉子是保温状态,就会把它重新开启,问多少秒之后鸡蛋的热量会达到2*t先把题目理解了,翻译的应该没问题,看k,d和t这么大就应该是找公式,仔细分析一下你会...

加载中... 434

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

A. Save Energy!

time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputJulia is going to cook a chicken in the kitchen of her dormitory. To save energy, the stove in the ...

xiaoxiede_wo的博客 390

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

codeforces 936A Save Energy(数学思维)

Julia is going to cook a chicken in the kitchen of her dormitory. To save energy, the stove in the kitchen automatically turns off after k minutes after turning on. During cooking, Julia goes to the ...

Link_Ray的博客 762

Codeforces Round #467 C题

A题B题就不用说了吧,连我都写出来了。说一下C题吧,就是因为C题才写这篇博客的,题目如下。C. Save Energy!time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputJulia is going to cook a chicken in the...

Bowen的博客 391

C - Save Energy!

题目链接:https://vjudge.net/contest/317253#problem/C Julia is going to cook a chicken in the kitchen of her dormitory. To save energy, the stove in the kitchen automatically turns off after k minutes afte...

年轻过成了秃顶 471

【CodeForces】937 C Save Energy! 数学

http://codeforces.com/contest/937/problem/C 烤一个面包,炉开一次烤k分钟, 每过d分钟,jury都会检查炉是否在工作,如果不在工作则把它打开。 已知整个面包在炉工作的时候需要t分钟才能烤熟,若微波炉不工作的时候,依靠余温需要2t分钟才能烤熟, 问总共需要多少分钟可以烤熟。(初始微波炉是开着的,并且只要一熟就可以拿出来)。 cook的时间呈周期性...

西瓜不甜的博客 382

Codeforces Round #467 (Div. 2)【A B C D】

A - Olympiad The recent All-Berland Olympiad in Informatics featured n participants with each scoring a certain amount of points. As the head of the programming committee, you are to determine ...

王小二的博客 616

Codeforces Round #467 (Div. 2)

A. Olympiad time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output The recent All-Berland Olympiad in Informatics f

zP1nG 644

(补题)CF 467 div2

A. Olympiadtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe recent All-Berland Olympiad in Informatics featured n participants with each scoring...

gtuif的博客 386

Codeforces Round #467 (Div. 2) 937ABC

第一题: A. Olympiad time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output The recent All-Berland Olympiad in Informatics featured n partic...

小博客 390

Codeforces Round #344 (Div. 2) A 题题解 (暴力)

A. Interview time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Blake is a CEO of a large company called "Blake

【落~风~月】 767
上一篇: Wannafly挑战赛10-E-小H和棋盘(暴力)
下一篇: Codeforces Round #467 (Div. 2)-D-Sleepy Game(DFS)
信仰..
博客等级 码龄11年 259粉丝 1422原创
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值