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. ...
随机推荐
- C++静态局部对象
7.5局部对象 在C++语言中,对于每一个变量和对象,都有其各自的作用域和生存期,这两个概念一个是空间的,一个是时间的.对象的作用域指的是该变量的程序文本区,对象的生存期则是程序执行过程中对象存在的时 ...
- Bandwidthd+Postgresql数据库配置笔记
Bandwidthd+Postgresql数据库配置笔记 本系列文章由ex_net(张建波)编写,转载请注明出处. http://blog.csdn.net/zjianbo/article/detai ...
- JetBrains PhpStorm 使用
· 在左侧显示当前文件位置 在左侧显示当前文件位置 alt + F1 在选择第1个在文件夹显示文件 在文件标签上 ctrl + 鼠标左键 或者 alt + F1 在选择第8个显示当前文件的函数,变量 ...
- 5.PHP 教程_PHP echo/print
PHP echo 和 print 语句 echo和print区别: echo-可以输出一个或多个字符串 print-只允许输出一个字符串,返回值总为1 提示:echo输出的速度比print快,echo ...
- thinkphp phpexcel导入
上次做了一个基于tp3.2.3的phpexcel导出,这次是phpexcel导入,准备材料phpexcel(不知道下载地址的查看我上一篇博文),虽说是基于thinkphp3.2.3来的,也只不过是引入 ...
- 上架app被拒原因总结
1. Terms and conditions(法律与条款) 1.1 As a developer of applications for the App Store you are bound by ...
- Page Cache, the Affair Between Memory and Files
Previously we looked at how the kernel manages virtual memory for a user process, but files and I/O ...
- Linux下使用ps命令来查看Oracle相关的进程
Linux下可以使用ps命令来查看Oracle相关的进程 Oracle Listener 这个命令会列出Oracle Net Listener的进程 [oracle@ www.linuxidc.com ...
- HDOJ 1423 Greatest Common Increasing Subsequence(dp)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1423 思路分析:[问题定义]给定两个序列A[0, 1,..., m]和B[0, 1, ..., n], ...
- 使用jetty和mongodb实现简易网盘接口
依赖库: 1,jetty(提供http方式接口) 2,mongodb的java驱动(访问mongodb存取文件) 3,thumbnailator包,进行缩略图生成 4,commons-fileuplo ...