Codeforces Round #315 (Div. 2A) 569A Music (模拟)
题目:Click here
题意:(据说这个题的题意坑了不少人啊~~~)题目一共给了3个数---- T 表示歌曲的长度(s)、S 表示下载了歌曲的S后开始第一次播放(也就是说S秒的歌曲是事先下载好的)、q 表示下载速度(每秒下载歌曲(q-1)/q秒)。问题就是播放的速度比下载的速度快,每当播放到没下载的位置,就会重新从头播放,输出的就是从头播放的次数(包括第一次)。
分析:高中物理追击问题,模拟下好了。
#include <bits/stdc++.h>
using namespace std;
const double EPS=1e-; double T, S, q;
int main() {
while( ~scanf("%lf%lf%lf", &T, &S, &q ) ) {
double dlpos = S;
double dlspeed = (q-)/q;
double plspeed = 1.0;
int ret = ;
while( dlpos < T ) { // 当下载位置到达T时再次播放一定结束了
double reachtime = dlpos/(plspeed-dlspeed);
dlpos = reachtime;
ret++;
if( fabs(dlpos - T) < EPS ) // 当恰好下载与播放同时到了歌曲最后结束,就跳出循环,不进行下次播放
break;
}
printf("%d\n", ret );
}
return ;
}
Codeforces Round #315 (Div. 2A) 569A Music (模拟)的更多相关文章
- Codeforces Round #301 (Div. 2)(A,【模拟】B,【贪心构造】C,【DFS】)
A. Combination Lock time limit per test:2 seconds memory limit per test:256 megabytes input:standard ...
- Codeforces Round #345 (Div. 2)【A.模拟,B,暴力,C,STL,容斥原理】
A. Joysticks time limit per test:1 second memory limit per test:256 megabytes input:standard input o ...
- Codeforces Round #543 (Div. 2) D 双指针 + 模拟
https://codeforces.com/contest/1121/problem/D 题意 给你一个m(<=5e5)个数的序列,选择删除某些数,使得剩下的数按每组k个数以此分成n组(n*k ...
- Codeforces Round #398 (Div. 2) A. Snacktower 模拟
A. Snacktower 题目连接: http://codeforces.com/contest/767/problem/A Description According to an old lege ...
- Codeforces Round #237 (Div. 2) B题模拟题
链接:http://codeforces.com/contest/404/problem/B B. Marathon time limit per test 1 second memory limit ...
- Codeforces Round #315 (Div. 2)
这次可以说是最糟糕的一次比赛了吧, 心没有静下来好好的去思考, 导致没有做好能做的题. Problem_A: 题意: 你要听一首时长为T秒的歌曲, 你点击播放时会立刻下载好S秒, 当你听到没有加载到的 ...
- Codeforces Round #371 (Div. 2) C 大模拟
http://codeforces.com/contest/714/problem/C 题目大意:有t个询问,每个询问有三种操作 ①加入一个数值为a[i]的数字 ②消除一个数值为a[i]的数字 ③给一 ...
- Codeforces Round #436 (Div. 2)C. Bus 模拟
C. Bus time limit per test: 2 seconds memory limit per test: 256 megabytes input: standard input out ...
- Codeforces Round #327 (Div. 2) B. Rebranding 模拟
B. Rebranding The name of one small but proud corporation consists of n lowercase English letters. ...
随机推荐
- [NOIP1999提高] CODEVS 1047 邮票面值设计(dfs+dp)
dfs出邮票的各种面值,然后dp求解. ------------------------------------------------------------------------------- ...
- python -- 计算数学题--用程序解决问题1
1.#一个四位数,各位数字互不相同,所有数字之和等于6,并且这个数是11的倍数,#则满足这种要求的四位数有多少个? 代码如下: # -*- coding: UTF-8 -*-import systyp ...
- C#中WebClient使用DownloadString中文乱码的解决办法
原文:C#中WebClient中文乱码的解决办法 第一次尝试: string question = textBox1.Text.ToString(); WebClient client= new We ...
- BZOJ 2016: [Usaco2010]Chocolate Eating
题目 2016: [Usaco2010]Chocolate Eating Time Limit: 10 Sec Memory Limit: 162 MB Description 贝西从大牛那里收到了 ...
- 从一个App跳转到另一个App
在跳入App的info中配置Bundle identifier 在跳入App的info中配置URL Schemes 在另一个应用程序中按照上边的操作添加openURL并运行,就可以跳转了 调用open ...
- Android 建造者(Builder)模式
关于 Builder 模式 详述:http://blog.csdn.net/jjwwmlp456/article/details/39890699 先来张图 看到 Android 中 使用了 Bui ...
- 鼠标放上去图片慢慢变大js 或 变大
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- 「OC」 基本语法
一.OC简介 在C语言的基础上,增加了一层最小的面向对象语法:完全兼容C语言:可以在OC代码中混入C语言代码,甚至是C++代码:可以使用OC开发Mac OS X平台和iOS平台的应用程序. 二.OC语 ...
- 设计模式值六大原则——设计模式之六大原则——单一职责原则(SRP)
定义: 应该有且仅有一个原因引起类的变更. There should never be more than one reason for a class to change. 优点: 1.类的复杂性降 ...
- TF-IDF算法-自动提取关键词汇
引子:Automatic Keyphrase extraction 很长文章里面,如何自动提取关键词汇呢? 比如在<中国的蜜蜂养殖>的长文里面,我们准备提取它的关键词.首先一个思路, 那些 ...