码迷,mamicode.com
首页 > 其他好文 > 详细

CodeForces 404B 手速题

时间:2015-02-25 00:43:16      阅读:204      评论:0      收藏:0      [点我收藏+]

标签:

//CodeForces 404B

 1 #include "iostream"
 2 #include "cstdio"
 3 #include "cstring"
 4 #include "algorithm"
 5 using namespace std;
 6 const __int64 N = 1e6;
 7 double a, d;
 8 int n;
 9 
10 int main()
11 {
12     int i;
13     scanf("%lf%lf%d", &a, &d, &n);
14     __int64 sum = 0;
15     __int64 DN = d * N + 0.5, AN = a * N + 0.5;
16     for(i = 1; i <= n; ++i) {
17         sum += DN;
18         sum %= (AN << 2);
19         if(sum >= 3 * AN)
20             printf("0 %f\n", (double)((AN << 2) - sum) / N);
21         else if(sum >= (AN << 1))
22             printf("%lf %lf\n", (double)(3 * AN - sum) / N, (double)AN / N);
23         else if(sum >= AN)
24             printf("%lf %lf\n", (double)AN / N, (double)(sum - AN) / N);
25         else
26             printf("%lf 0\n", (double)sum / N);
27     }
28 }

 

CodeForces 404B 手速题

标签:

原文地址:http://www.cnblogs.com/AC-Phoenix/p/4299070.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!