Codeforces Round #237 (Div. 2) B. Marathon(卡long long)
题目:http://codeforces.com/contest/404/problem/B
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
using namespace std; int main()
{
__int64 g; //g一定要是长整形,因为数据会超int.这个也是错误的最主要原因
int n, i;
double a, d, x, y, sum, cnt;
while(~scanf("%lf%lf%d", &a, &d, &n))
{
sum = (double)(a*);
for(i = ; i <= n; i++)
{
cnt = (double)i*d; g =(long long)(cnt/sum); //这里一定把要转换的部分加上括号
cnt = (double)(cnt-g*sum);
if(cnt-a<=)
{
y = ;
x = cnt;
}
else if(cnt-*a<=)
{
x = a;
y = cnt-a;
}
else if(cnt-*a<=)
{
x = a-(cnt-*a);
y = a;
}
else
{
x = ;
y = a-(cnt-*a);
}
printf("%.10lf %.10lf\n", x, y);
}
}
return ;
}
Codeforces Round #237 (Div. 2) B. Marathon(卡long long)的更多相关文章
- 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 #237 (Div. 2) A
链接:http://codeforces.com/contest/404/problem/A A. Valera and X time limit per test 1 second memory l ...
- Codeforces Round #237 (Div. 2)
链接 A. Valera and X time limit per test:1 secondmemory limit per test:256 megabytesinput:standard inp ...
- Codeforces Round #237 (Div. 2) C. Restore Graph(水构造)
题目大意 一个含有 n 个顶点的无向图,顶点编号为 1~n.给出一个距离数组:d[i] 表示顶点 i 距离图中某个定点的最短距离.这个图有个限制:每个点的度不能超过 k 现在,请构造一个这样的无向图, ...
- [Codeforces Round #237 (Div. 2)] A. Valera and X
A. Valera and X time limit per test 1 second memory limit per test 256 megabytes input standard inpu ...
- Codeforces Round #378 (Div. 2) D题(data structure)解题报告
题目地址 先简单的总结一下这次CF,前两道题非常的水,可是第一题又是因为自己想的不够周到而被Hack了一次(或许也应该感谢这个hack我的人,使我没有最后在赛后测试中WA).做到C题时看到题目情况非常 ...
- Codeforces Round #403 (Div. 2, based on Technocup 2017 Finals)
Codeforces Round #403 (Div. 2, based on Technocup 2017 Finals) 说一点东西: 昨天晚上$9:05$开始太不好了,我在学校学校$9:40$放 ...
- Codeforces Round #297 (Div. 2)D. Arthur and Walls 暴力搜索
Codeforces Round #297 (Div. 2)D. Arthur and Walls Time Limit: 2 Sec Memory Limit: 512 MBSubmit: xxx ...
- Codeforces Round #439 (Div. 2)【A、B、C、E】
Codeforces Round #439 (Div. 2) codeforces 869 A. The Artful Expedient 看不透( #include<cstdio> in ...
随机推荐
- Configure xterm Fonts and Colors for Your Eyeball
https://wiki.mpich.org/mpich/index.php/Configure_xterm_Fonts_and_Colors_for_Your_Eyeball Screenshot ...
- jquery ajax超时设置
var ajaxTimeoutTest = $.ajax({ url:'', //请求的URL timeout : 1000, //超时时间设置,单位毫秒 type : 'get', //请求方式 ...
- C# 越来越复杂了
自从三年前来到现在的公司以后,基本上不怎么使用.NET进行开发了.但最近因为公司有个CRM的项目,所以只有重新检起.NET进行开发. 因为近3年没有搞.NET的开发了,因此也不敢乱整个框架,在看了一周 ...
- UVALive 4872 Underground Cables 最小生成树
题目链接: 题目 Underground Cables Time Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %ll ...
- ts 使用Visual Studio2012和TFS网站管理源代码
所需工具 Visual Studio 2012 http://tfs.visualstudio.com/ 微软网站 微软账号 hotmail 或live都行 达到目的 适合于个人项目,多用户 ...
- oracle——外连接查询
一.问题描述 有时我们为了保留某个表中的数据,而该表中的数据在另外一个关联表中未必都存在对应,此时就应该试用外连接查询. 比如:两个表,产品表和子产品表 注:子产品的parent_product_id ...
- Linux 操作Mysql详解
一.引言 想使用Linux已经很长时间了,由于没有硬性任务一直也没有系统学习,近日由于工作需要必须使用Linux下的MySQL.本以为有 Windows下使用SQL Server的经验,觉得在Linu ...
- 设置Eclipse智能提示
原地址:http://blog.csdn.net/sz_bdqn/article/details/4956162 今天有点时间,研究了一下MyEclispse的智能感知的功能.刚开始使用它时总是感觉如 ...
- Javascript的9张思维导图学习
思维导图小tips:思维导图又叫心智图,是表达发射性思维的有效的图形思维工具 ,它简单却又极其有效,是一种革命性的思维工具.思维导图运用图文并重的技巧,把各级主题的关系用相互隶属与相关的层级图表现出来 ...
- ios 沙盒 NSCoding(相当于JAVA对象序列化) 归档 数据存储
通过NSCoding能实现像JAVA一样能够实现对象的序列化,可以保存对象到文件里. NSCoding 跟其他存储方式略有不同,他可以存储对象 对象存储的条件是: 对象需要遵守 NSCoding 协议 ...