题目: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)的更多相关文章

  1. Codeforces Round #237 (Div. 2) B题模拟题

    链接:http://codeforces.com/contest/404/problem/B B. Marathon time limit per test 1 second memory limit ...

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

  3. Codeforces Round #237 (Div. 2)

    链接 A. Valera and X time limit per test:1 secondmemory limit per test:256 megabytesinput:standard inp ...

  4. Codeforces Round #237 (Div. 2) C. Restore Graph(水构造)

    题目大意 一个含有 n 个顶点的无向图,顶点编号为 1~n.给出一个距离数组:d[i] 表示顶点 i 距离图中某个定点的最短距离.这个图有个限制:每个点的度不能超过 k 现在,请构造一个这样的无向图, ...

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

  6. Codeforces Round #378 (Div. 2) D题(data structure)解题报告

    题目地址 先简单的总结一下这次CF,前两道题非常的水,可是第一题又是因为自己想的不够周到而被Hack了一次(或许也应该感谢这个hack我的人,使我没有最后在赛后测试中WA).做到C题时看到题目情况非常 ...

  7. Codeforces Round #403 (Div. 2, based on Technocup 2017 Finals)

    Codeforces Round #403 (Div. 2, based on Technocup 2017 Finals) 说一点东西: 昨天晚上$9:05$开始太不好了,我在学校学校$9:40$放 ...

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

  9. Codeforces Round #439 (Div. 2)【A、B、C、E】

    Codeforces Round #439 (Div. 2) codeforces 869 A. The Artful Expedient 看不透( #include<cstdio> in ...

随机推荐

  1. Qt中使用Firebird 和 Firebird Embedded

    编译数据库连接插件 拷贝ibase.h,fbclient_ms.lib(改名gds32_ms.lib)等到ibase.pro项目文件夹下 configure -platform win32-msvc2 ...

  2. Halcon学习笔记之缺陷检测(一)

    例程:surface_scratch.hdev 说明:这个程序利用局部阈值和形态学处理提取表面划痕 代码中绿色部分为个人理解和注释,其余为例程中原有代码 *surface_scratch.hdev:e ...

  3. JDBC 学习笔记(四)—— 自定义JDBC框架+Apache—DBUtils框架+事务管理+操作多表

    本文目录:       1.自定义JDBC框架 ——数据库元数据:DataBaseMetaData        2.自定义JDBC框架 ——数据库元数据:DataBaseMetaData       ...

  4. IntelliJ IDEA 14 利用JRebel实现热部署 二

    前言:今天下午和一个qq群里讨论JRebel时,忽然得到“自动部署”的奥秘--真有听君一席话,胜读十年书的感悟. 这是此群友的热部署博客:http://blog.csdn.net/martinkey/ ...

  5. SQL SERVER 之 填充因子

    填充因子依附索引而存在,但创建索引,就意味着要对表进行DML时,必须处理额外的工作量(也就是对索引结构的维护)以及存储方面的IO开销. 所以创建索引时,需要考虑创建索引所带来的查询性能方面的提高,与引 ...

  6. spoj 147

    dfs枚举真值 #include <cstdio> #include <cstring> #include <cstdlib> #include <stack ...

  7. SystemInfo.deviceUniqueIdentifier 返回机器码

    SystemInfo.deviceUniqueIdentifier 返回机器码

  8. zoj 3232 It's not Floyd Algorithm(强联通分量,缩点)

    题目 /******************************************************************/ 以下题解来自互联网:Juny的博客 思路核心:给你的闭包 ...

  9. Intent(二)

    以Android高级编程一书中的一个例子为例: 1, 创建一个ContactPicker项目,其中包含一个ContactPicker Activity package com.paad.contact ...

  10. java 追加写入代码一例

    最近最项目参数化的时候用到,场景是这样的,需要测试A和B两个接口,其中B接口传入的参数必须是传递给A接口过的,所以整理一个思路就是: 1. 正常调用A接口,但是将传递给A接口的参数保存到文本里,此处要 ...