【CodeForces - 195A】Let's Watch Football (追及问题,模拟)

题干:

Valeric and Valerko missed the last Euro football game, so they decided to watch the game's key moments on the Net. They want to start watching as soon as possible but the connection speed is too low. If they turn on the video right now, it will "hang up" as the size of data to watch per second will be more than the size of downloaded data per second.

The guys want to watch the whole video without any pauses, so they have to wait some integer number of seconds for a part of the video to download. After this number of seconds passes, they can start watching. Waiting for the whole video to download isn't necessary as the video can download after the guys started to watch.

Let's suppose that video's length is c seconds and Valeric and Valerko wait tseconds before the watching. Then for any moment of time t0, t ≤ t0 ≤ c + t, the following condition must fulfill: the size of data received in t0 seconds is not less than the size of data needed to watch t0 - t seconds of the video.

Of course, the guys want to wait as little as possible, so your task is to find the minimum integer number of seconds to wait before turning the video on. The guys must watch the video without pauses.

Input

The first line contains three space-separated integers ab and c (1 ≤ a, b, c ≤ 1000, a > b). The first number (a) denotes the size of data needed to watch one second of the video. The second number (b) denotes the size of data Valeric and Valerko can download from the Net per second. The third number (c) denotes the video's length in seconds.

Output

Print a single number — the minimum integer number of seconds that Valeric and Valerko must wait to watch football without pauses.

Examples

Input

4 1 1

Output

3

Input

10 3 2

Output

5

Input

13 12 1

Output

1

Note

In the first sample video's length is 1 second and it is necessary 4 units of data for watching 1 second of video, so guys should download 4 · 1 = 4 units of data to watch the whole video. The most optimal way is to wait 3 seconds till 3 units of data will be downloaded and then start watching. While guys will be watching video 1 second, one unit of data will be downloaded and Valerik and Valerko will have 4 units of data by the end of watching. Also every moment till the end of video guys will have more data then necessary for watching.

In the second sample guys need 2 · 10 = 20 units of data, so they have to wait 5 seconds and after that they will have 20 units before the second second ends. However, if guys wait 4 seconds, they will be able to watch first second of video without pauses, but they will download 18 units of data by the end of second second and it is less then necessary.

 

题目大意:

   输入a,b,c,第一个数字(a)表示观看一秒钟视频所需的数据大小。第二个数字(b)表示每秒可以从网络下载的数据大小。第三个数字(c)表示视频的长度(以秒为单位)。问我如果想中间不停顿的播放,则至少需要等他下载多少秒再开始播放?

解题报告:

    菜啊,,想错式子了啊刚开始。一直想推一个追及的式子,结果用时间的等式或者用下载量的等式,最后都推出来类似1=1的东西,,,崩溃,,后来发现不能这么看,因为提前几秒下载的时间你是不知道的啊。其实设提前下载t秒,一共视频是c秒,这个告诉你了,所以t*b+c*b=a*c就可以了。。。。并且需要向上取整。。。水题

AC代码:

#include<bits/stdc++.h>
using namespace std;int main()
{int a,b,c;double x;cin>>a>>b>>c;x=a*c-b*c;printf("%d\n",(int)ceil(x/b));return 0 ;
}

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/441421.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

下面不是mysql特性_下面( )不是MySQL的特性。_学小易找答案

【单选题】如何检测 2型糖尿病【填空题】<5>以下do-while语句中循环体的执行次数是( ). a10; b0; do { b2; a-2b; } while (a>0);【单选题】2 型糖尿病 多 发在什么年龄段【填空题】<5>以下程序的输出结果为( )。 #include "stdio.h" main() {int a; …

*【CodeForces - 195B】After Training (多解,模拟)

题干&#xff1a; After a team finished their training session on Euro football championship, Valeric was commissioned to gather the balls and sort them into baskets. Overall the stadium has n balls and m baskets. The baskets are positioned in a row from l…

pandas打印全部列_python——pandas练习题1-5

练习1-开始了解你的数据探索Chipotle快餐数据相应数据集&#xff1a;chipotle.tsvimport pandas as pd chipopd.read_csv("exercise_data/chipotle.tsv",sept) chipo.head(5)chipo.shape[0] #查看有多少行4622chipo.shape[1] #查看有多少列5chipo.columns #打印所…

【POJ - 2406】Power Strings (KMP,最小循环节)

题干&#xff1a; Given two strings a and b we define a*b to be their concatenation. For example, if a "abc" and b "def" then a*b "abcdef". If we think of concatenation as multiplication, exponentiation by a non-negative in…

python wmi mac变动_Python WMI参数反转

使用python的wmi模块创建vss快照&#xff0c;我发现除非将它们反向&#xff0c;否则这些参数将不起作用&#xff1a;importwmidefvss_create():shadow_copy_servicewmi.WMI(monikerwinmgmts:\\\\.\\root\\cimv2:Win32_ShadowCopy)resshadow_copy_service.Create(ClientAccessib…

【 HDU - 2594 】Simpsons’ Hidden Talents(KMP应用,求最长前缀后缀公共子串)

题干&#xff1a; Homer: Marge, I just figured out a way to discover some of the talents we weren’t aware we had. Marge: Yeah, what is it? Homer: Take me for example. I want to find out if I have a talent in politics, OK? Marge: OK. Homer: So I take…

python两次调用write连续写入的数据之间_两次调用文件的write 方法,以下选项中描述正确的是...

两次调用文件的write 方法&#xff0c;以下选项中描述正确的是答&#xff1a;连续写入的数据之间无分隔符中国大学MOOC: 斜弯曲、拉(压)弯曲组合变形的危险点都是单向应力状态。答&#xff1a;对急性宫外孕破裂或的最主要症状是答&#xff1a;突然一侧下腹部撕裂样疼痛Some thi…

拉格朗日差值 - 杜教板子

牛客网暑期ACM多校训练营(第一场) F Sum of Maximum 杜教板子&#xff1a; 证明https://blog.csdn.net/Lee_w_j__/article/details/81135539 #include <cstdio> #include <iostream> #include <vector> #include <cstring> #include <algorithm&…

python归并排序 分词_python实现归并排序,归并排序的详细分析

学习归并排序的过程是十分痛苦的。它并不常用&#xff0c;看起来时间复杂度好像是几种排序中最低的&#xff0c;比快排的时间复杂度还要低&#xff0c;但是它的执行速度不是最快的。很多朋友不理解时间复杂度低为什么运行速度不一定快&#xff0c;这个不清楚的伙伴可以看下我之…

CCFCSP 2018年9月 -- 部分题目

CCF201809 -- 第一题 &#xff1a;买菜 问题描述   在一条街上有n个卖菜的商店&#xff0c;按1至n的顺序排成一排&#xff0c;这些商店都卖一种蔬菜。   第一天&#xff0c;每个商店都自己定了一个正整数的价格。店主们希望自己的菜价和其他商店的一致&#xff0c;第二天…

servlet中显示mysql字段_Java Servlet:从数据库获取信息并在屏幕上显示它

创建它代表了表的每一个项目(行)一个JavaBean类。创建一个使用JDBC返回这些项目列表的DAO类。然后在servlet中&#xff0c;只需使用HttpServletRequest#setAttribute()将请求范围中的项目列表&#xff0c;使用RequestDispatcher#forward()将请求转发到JSP文件&#xff0c;并使用…

【CodeForces - 689B】Mike and Shortcuts(Dijkstra最短路,或者bfs跑状态类似spfa)

题干&#xff1a; Recently, Mike was very busy with studying for exams and contests. Now he is going to chill a bit by doing some sight seeing in the city. City consists of n intersections numbered from 1 to n. Mike starts walking from his house located a…

sqlserver mysql分页_SQLServer与MySQL中分页查询sql语句示例

/***author blovedr*功能&#xff1a;SQLServer与MySQL中分页查询sql语句示例*日期&#xff1a; 2018年8月17日 10:58*注释&#xff1a; 学习数据库MySQL的点点记录&#xff0c; 谢谢网上各位大神分享经验与资料&#xff0c; 欢迎大神批评与交流。*/分页查询 2018.8.16 …

【51Nod - 1103】N的倍数 (思维,鸽巢原理也叫抽屉定理,求倍数问题取模)

题干&#xff1a; 一个长度为N的数组A&#xff0c;从A中选出若干个数&#xff0c;使得这些数的和是N的倍数。 例如&#xff1a;N 8&#xff0c;数组A包括&#xff1a;2 5 6 3 18 7 11 19&#xff0c;可以选2 6&#xff0c;因为2 6 8&#xff0c;是8的倍数。 Input 第1行…

java位操作_关于java按位操作运算

<1>.在了解位移之前&#xff0c;先了解一下正数和负数的二进制表示形式以及关系&#xff1a;举例15和-15&#xff1a;15 的原码&#xff1a; 00000000 00000000 00000000 00001111补码&#xff1a; 11111111 11111111 11111111 111100001 -15的原码&#xff1a;11111111 …

【51Nod - 1117 】聪明的木匠 (贪心,哈夫曼树,时光倒流)

题干&#xff1a; 一位老木匠需要将一根长的木棒切成N段。每段的长度分别为L1,L2,......,LN&#xff08;1 < L1,L2,…,LN < 1000&#xff0c;且均为整数&#xff09;个长度单位。我们认为切割时仅在整数点处切且没有木材损失。 木匠发现&#xff0c;每一次切割花费的体…

java生成16位随机数_java中如何产生一个16位数字组成的随机字符串?谢谢各位了...

展开全部方法如下&#xff1a;Random rannew random();boolean flagtrue;while(flag){int aran.nextInt(99999999);int bran.nextInt(99999999);long ca*100000000Lb;if(c>1000000000000000L&&c<9999999999999999L){flagfalse;c1c;String numString.valueOf(c1);…

java utf-8 gbk_Java 字符转码之UTF-8转为GBK/GB2312

java跟python类似的做法&#xff0c;在java中字符串的编码是java修改过的一种Unicode编码&#xff0c;所以看到java中的字符串&#xff0c;心理要默念这个东西是java修改过的一种Unicode编码的编码。packagestring;importjava.nio.charset.Charset;public classUTF82GBK {publi…

【CodeForces - 760B 】Frodo and pillows (二分题意,注意细节)

题干&#xff1a; n hobbits are planning to spend the night at Frodos house. Frodo has n beds standing in a row and m pillows (n ≤ m). Each hobbit needs a bed and at least one pillow to sleep, however, everyone wants as many pillows as possible. Of cour…

eclipse wsdl2java_使用Eclipse的wsdl2java工具

一、用Eclipse调用Axis的wsdl2java1.在eclipse里面新建一个项目或已有的项目&#xff1b;2.导入activation.jaraxis.jarcommons-discovery.jarcommons-logging-1.0.3.jarjaxrpc.jarsaaj.jarwsdl4j-1.5.2.jar包3右击你的工程&#xff0d;Run As&#xff0d;Run...&#xff0d;右…