题目: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. ASP.NET Web – AJAX 回送

    使用UpdatePanel时要一起使用的控件是ScriptManager.ScriptManager类加载了包含几个功能的JavaScript函数.也可以使用这个类加载自己定制脚本.ScriptMan ...

  2. UVA 12382 Grid of Lamps 贪心

    题目链接: C - Grid of Lamps Time Limit:1000MSMemory Limit: 0KB 问题描述 We have a grid of lamps. Some of the ...

  3. C# memcache

    概述 memcache是一套开放源的分布式高速缓存系统.由服务端和客户端组成,以守护程序(监听)方式运行于一个或多个服务器中,随时会接收客户端的连接和操作.memcache主要把数据对象缓存到内存中, ...

  4. 剑指offer--面试题9

    题目一:求斐波那契数列第n项 自己所写代码如下: #include "stdafx.h" #include<iostream> long Fibonacci(unsig ...

  5. 1-Highcharts环境介绍及配置

    Highcharts:功能强大.开源.美观.图表丰富.兼容绝大多数浏览器的纯js图表库,废话不多说,直接进入主题! 首先,下载Highcharts包文件,下载地址如下: 中文网下载中心:http:// ...

  6. Linq to Entity中连接两个数据库时要注意的问题

    Linq to Entity中连接两个数据库时要注意的问题 今天大学同学问了我一个问题,Linq to Entity中连接两个数据库时,报错“指定的 LINQ 表达式包含对与不同上下文关联的查询的引用 ...

  7. Android SeekBar的OnSeekBarChangeListener

    seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { /** * 拖动中数值的时候 * @param f ...

  8. Hibernate逍遥游记-第15章处理并发问题-003乐观锁

    1. 2. drop database if exists SAMPLEDB; create database SAMPLEDB; use SAMPLEDB; drop table if exists ...

  9. JDBC批处理---(java 对数据库的回滚) .

    1先看一下程序: package com.redking.jdbc.demo;    import java.sql.Connection;    import java.sql.DriverMana ...

  10. Win8-64位安装OpenSSL详细过程

    相关软件: 1.ActivePerl 5.22.1 : http://www.activestate.com/activeperl/downloads 2.Microsoft visual_studi ...