- #include <bits/stdc++.h>
- using namespace std;
- int main(){
- int ts;
- cin>>ts;
- for(int k = 1; k <= ts; k++){
- int n;
- cin>>n;
- int a[n];
- double e[n];
- memset(a, 0, sizeof(a));
- memset(e, 0, sizeof(e));
- for(int i = 0; i <n; i++) cin>>a[i];
- e[n-1] = a[n-1]*1.00;
- for(int i = n-2; i >= 0; i--){
- if(n-i<=6) {
- for(int j = i+1; j <n; j++){
- e[i] += e[j];
- }
- e[i]/= (n-i-1)*1.00;
- e[i]+= a[i]*1.0;
- }
- else{
- for(int j = i+1; j <= i+6; j++){
- e[i] += e[j];
- }
- e[i]/=6.00;
- e[i]+= a[i]*1.00;
- }
- }
- printf("Case %d: %0.10lf\n",k,e[0]);
- }
- return 0;
- }
Thursday, 27 July 2017
Lightoj 1030 - Discovering Gold
Subscribe to:
Post Comments (Atom)
Most Featured Post
Lightoj 1159 - Batman
http://lightoj.com/volume_showproblem.php?problem=1159 problem analysis: First i thought of this as if s1, s2 and s3 are those three str...
-
http://lightoj.com/volume_showproblem.php?problem=1382 Problem analysis: This is a rare problem i wrote about so far. After much strugg...
-
http://lightoj.com/volume_showproblem.php?problem=1159 problem analysis: First i thought of this as if s1, s2 and s3 are those three str...
No comments:
Post a Comment