zoukankan      html  css  js  c++  java
  • CodeForces 404B 手速题

    //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
    ", (double)((AN << 2) - sum) / N);
    21         else if(sum >= (AN << 1))
    22             printf("%lf %lf
    ", (double)(3 * AN - sum) / N, (double)AN / N);
    23         else if(sum >= AN)
    24             printf("%lf %lf
    ", (double)AN / N, (double)(sum - AN) / N);
    25         else
    26             printf("%lf 0
    ", (double)sum / N);
    27     }
    28 }
  • 相关阅读:
    Working with nil
    Determining Equality of Objects
    NSLog中的%@
    ld
    恢复HDFS误删数据
    一个缓冲区溢出示例
    SpringBoard
    Symbol Table
    feof使用注意
    -g vs -rdynamic
  • 原文地址:https://www.cnblogs.com/AC-Phoenix/p/4299070.html
Copyright © 2011-2022 走看看