Mars to save the [Mathematics, and a little prefix]

FM6CI4QCZ0I`FEA`~QX$MUH


This title is a mathematical reasoning, we need to ensure that the rest of the car is full of oil, so whenever scrapped a car, make sure the rest of the car is full of oil.


Then launch it every time with s / n (n = 1 ... .n), km scrapped a ...

As the amount of data, then the violence will time-out, then you would have a prefix and a little knowledge of


Attach Code:

  1 #include <cstdio>
  2 
  3 long double a[1000005];
  4 int main(){
  5 	a[1] = 1;
  6 	for(int i = 2; i <= 1000000; ++ i)
  7 		a[i] = a[i-1] + (long double)1.0 / i;
  8 	int T;
  9 	scanf("%d",&T);
 10 	while(T--){
 11 		int n;long long s;
 12 		scanf("%d%lld", &n, &s);
 13 		printf("%.10Lf\n", a[n] * s);
 14 	}
 15 	return 0;
 16 }

Guess you like

Origin www.cnblogs.com/rstz/p/12393210.html