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

流量PID控制(开度前馈量计算+辅助PID) PLC通过伯努利方程近似计算水箱流量(FC)-CSDN博客文章浏览阅读1.6k次。本文介绍了如何使用PLC通过伯努利方程近似计算水箱中的液体流量,主要涉及流量计算、模型验证、梯形图编程及STL代码实现。适合自动化领域的学习者参考。单容双容水箱建模(simulink仿真+PLC代码)_水箱系统的建模方法-CSDN博客文章浏览阅读2k次。该博客介绍了如何使用伯努利方程建立单容和双容水箱模型,详细阐述了从理论建模到PLC编程的实现过程。 阅读详情

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 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.

输入

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

输出

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 .

样例

input
3 2 6
output
6.5
input
4 2 20
output
20.0

题意

一个电磁炉烹饪一只鸡 打开时候需要t时间 否怎需要2t时间
一次点火可以持续k时间 每经过d时间就检查一下电磁炉是否打开 问这只鸡煮熟的总时间

数学判定+二分查找最优时间

AC代码

#include <bits/stdc++.h>
using namespace std;

#define CLR(a,b) memset(a,(b),sizeof(a))
#define LL long long

const int MAXN = 1e3+10;
const double eps = 1e-15;
LL k, d, t, ans;
LL aa, bb;

bool check(double x)
{
    double a, b;
    LL p = (LL)x/ans;
    a = aa * p;
    b = bb * p;
    x -= ans * p;
    if(x <= aa)
        a += x;
    else
        a += aa, b += x-aa;
    return (a*2+b>=t*2);
}

int main()
{
    cin >> k >> d >> t;
    ans = d*((k+d-1)/d);
    aa = (k/d)*d+(k%d);
    bb = ans - aa;
    double l = 0.0, r = 3e18;
    for(int i = 1; i <= 100; i++) {
        double id = (l+r)/2;
        if(check(id))
            r = id;
        else
            l = id;
    }
    return 0*printf("%.15f\n",l);
}
YOLOv11改进:引入SSA序列打乱注意力模块与MSCSA二次创新模块,适配目标检测、图像分类与实例分割 YOLOv11改进:引入SSA与MSCSA模块提升CV任务性能 摘要: 本文提出在YOLOv11中集成SSA(序列打乱注意力)和MSCSA(多尺度上下文序列打乱注意力)模块,以解决计算机视觉任务中的关键挑战。SSA通过序列打乱和局部窗口注意力机制,在降低计算复杂度的同时增强长距离依赖建模能力;MSCSA进一步引入多尺度上下文融合和动态序列打乱策略,优化了多尺度目标检测和实例分割的边界特征处理。这些改进有效解决了传统注意力机制在全局上下文建模、局部细节保持和序列顺序敏感性方面的不足。实验表明,该方法在目标检测 阅读详情

相关推荐

iOS安全攻防:从DarkSword漏洞利用链剖析到纵深防御实践

在移动安全领域,内存破坏漏洞(如堆溢出、释放后使用)是攻击者突破系统防线、实现远程代码执行和权限提升的核心技术原理。这些漏洞利用技术通过精心构造的攻击链,能够绕过沙箱、地址空间布局随机化等安全机制,最终威胁设备内核安全,其技术价值在于揭示了系统安全架构的潜在薄弱环节。在iOS应用开发与系统防护中,理解此类攻击链对于构建有效的纵深防御体系至关重要。应用场景涵盖从安全编码、网络通信加固到运行时应用程序自保护等多个层面。本文以DarkSword工具包为例,深入拆解其利用链,并分享如何通过内存安全实践、代码签名强化

weixin_30357231的博客 491

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

SQL Prompt 9.0插件突然无法使用解决办法(附防联网激活)多图+文字

可能由于Redgate公司最近抓盗版抓得严,导致激活后的SQL Prompt联网后突然无法使用,无论卸载重装都没办法继续使用,本人同时使用SQL Assistant和SQL Prompt,我喜欢SQL Assistant代码提示功能,而SQL Prompt我喜欢将查询结果复制后可以直接生产插入脚本,这是最爽的一件事,即便对表有多么熟悉,没有这些插件,几行语法都要敲大半天,目前本人已经离不开这两个插...

骚团长的博客 1万+

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

滑模控制算法——基本原理(附MATLAB程序)

选择一个滑模面和是设计参数。是滑模面函数,通常我们希望系统状态在的面上滑动。我们以一个简单的二阶系统作为示例,其状态空间方程为:是系统矩阵是输入矩阵是输出矩阵假设我们的系统如下:滑模控制算法的核心在于设计合适的滑模面和控制律,并分析系统在滑模面上的稳定性。通过上述公式和步骤,可以有效地设计滑模控制器,以处理具有非线性和不确定性的动态系统。总的来说,滑模控制算法因其鲁棒性和灵活性在处理复杂控制问题中表现出色,但在实际应用中需要精心设计以克服抖振现象和其他潜在问题。BuxuABDC。

qq_35623594的博客 2万+

最新首发——boss直聘爬虫

本文介绍了使用Python开发Boss直聘爬虫的核心思路和技术要点。通过模拟浏览器访问搜索页面获取Cookie,然后构建API请求获取职位数据。关键步骤包括:1)使用DrissionPage库初始化浏览器;2)模拟用户浏览行为获取必要参数;3)设置完整的请求头信息;4)通过POST请求获取JSON格式的职位数据。文章提供了详细的代码实现,包括浏览器模拟、API请求构建、数据处理等核心功能模块,并强调了最新版接口改为POST访问的特点。该爬虫可自动翻页采集数据并保存为Excel文件,适用于安全实习等职位信息的

2301_79735033的博客 3349

Codeforces #467 (Div. 2) B. Vile Grasshoppers ( 数学

B. Vile Grasshoppers 题目描述 The weather is fine today and hence it’s high time to climb the nearby pine and enjoy the landscape. The pine’s trunk includes several branches, located one above another...

Yishui_lovely 729

【技术纵览】行为识别前沿模型演进:从CNN到多模态大模型

本文全面解析了行为识别技术从CNN到多模态大模型的演进历程,重点介绍了SlowFast、TimeSformer、VideoMAE和InternVideo等SOTA模型的核心创新与应用实践。通过对比分析各代模型在Kinetics-400等数据集上的表现,揭示了自监督学习和多模态融合如何推动行为识别准确率突破85%,并探讨了工业部署中的技术选型策略与优化方向。

weixin_29169505的博客 163

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

C. 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, th...

信仰.的博客 720

打开UG会安装报错:initialization internal ERROR 的提示框,提示line 1344 of错误的解决方案

打开UG会安装报错:initialization internal ERROR 的提示框,提示line 1344 of错误的解决方案

Q82556499的博客 3539

解读(DivideMix)DIVIDEMIX: LEARNING WITH NOISY LABELS AS SEMI-SUPERVISED LEARNING

这是Salesforce在今年年初出的一篇关于半监督学习的文章被ICLR 2020收录,目前还保持在SOTA状态。 文章主要做了两点工作: • 提出了一个co-divide方法。 • 利用label co-refinement 和co-guessing 改善之前的谷歌提出的MixMatch方法 1.co-divide方法 大概思路:同时训练两个网络,让每个网络在样本损失分布上去拟合GMM模型,并利用GMM模型,将训练数据分为标签数据和未标签数据,co-divide 使前面分的标签与未标签数据分别在

so 5043

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

一种基于机载LiDAR点云电力线自动提取方法

文章目录一、引言二、算法实现2.1实现步骤2.2实现代码 一、引言 二、算法实现 2.1实现步骤 (1)首先采用首先采用高程滤波方法去除地面点和低矮地物点,滤波后的点云数据中除电力线点云外还含部分杆塔点、高植被点和噪声点。 (2)根据点云空间维度特征提取电力线点,使用空间密度聚类的方法实现单根电力线精确分离。 2.2实现代码 在这里插入代码片 ...

dayuhaitang1的博客 5179

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

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

OV9734 DATASHEET,完整规格书

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

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

题目链接 找到一个时间点,这个时间点锅已经停了。那么此时可以形成一个周期,然后算出有多少这样的周期,最后处理一下结尾的点即可。(这么傻的题想了好久,太弱了) #include&lt;stdio.h&gt; #define ll long long int main() { ll k,d,t; while(~scanf("%lld%lld%lld",&amp;k,&amp;d,&...

zxy160的博客 269

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain&#39;s apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath(&#39;DeepLearnToolbox&#39;));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand(&#39;state&#39;,0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W&#39;); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand(&#39;state&#39;,0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = &#39;sigm&#39;;%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, &#39;Too big error&#39;);```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand(&#39;state&#39;,0)sae = saesetup([784 100]);sae.ae{1}.activation_function = &#39;sigm&#39;;sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)&#39;)% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;;nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, &#39;Too big error&#39;);```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x&#39;,28,28,60000))/255;test_x = double(reshape(test_x&#39;,28,28,10000))/255;train_y = double(train_y&#39;);test_y = double(test_y&#39;);%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you&#39;ll get around 1.2% errorrand(&#39;state&#39;,0)cnn.layers = { struct(&#39;type&#39;, &#39;i&#39;) %input layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 6, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %sub sampling layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 12, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, &#39;Too big error&#39;);```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, &#39;Too big error&#39;);%% ex2 neural net with L2 weight decayrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex3 neural net with dropoutrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex4 neural net with sigmoid activation functionrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex5 plotting functionalityrand(&#39;state&#39;,0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = &#39;softmax&#39;; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand(&#39;state&#39;,0)nn = nnsetup([784 20 10]); nn.output = &#39;softmax&#39;; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, &#39;Too big error&#39;);```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

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

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

加载中... 434

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

Codeforces Round#467

CF937A Olympiad(模拟)答案就是非0的数的种类数 CF937B Vile Grasshoppers(数学+暴力) CF936A Save Energy!(模拟) CF936B Sleepy Game(图论+dfs)

Icefox的博客 433

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

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

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 ...

海绵的博客 552

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

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

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 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) 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

How to Fold a Julia Fractal

How to Fold a Julia Fractal A tale of numbers that like to turn http://acko.net/blog/how-to-fold-a-julia-fractal/ 介绍如何生成Julia分形,非常好看的动态效果,叹为观止。

yyhustim的专栏 731
上一篇: Codeforces Educational 38 A. Word Correction
下一篇: Codeforces #467 (Div. 2) B. Vile Grasshoppers ( 数学
Yishui_Blog
博客等级 码龄10年 96粉丝 524原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值