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 }
时间: 2024-10-10 13:28:11