-
Notifications
You must be signed in to change notification settings - Fork 0
/
Day 0: Weighted Mean.cpp
53 lines (53 loc) · 1.08 KB
/
Day 0: Weighted Mean.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <iostream>
#include <cmath>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <algorithm>
#include <iomanip>
#include <assert.h>
#include <vector>
#include <cstring>
#include <map>
#include <deque>
#include <queue>
#include <stack>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <set>
#include <complex>
#include <list>
#include <climits>
#include <cctype>
#include <bitset>
#include <numeric>
#include<array>
#include<tuple>
#include <utility>
#include <functional>
#include <locale>
#define all(v) v.begin(),v.end()
#define mp make_pair
#define pb push_back
typedef long long int ll ;
using namespace std ;
int main()
{
int n ;
cin >> n ;
int arr[n] , w[n] ;
int sum = 0 ;
for(int i=0 ; i<n ;i++)
cin >> arr[i] ;
for(int i=0 ; i<n ;i++)
{
cin >> w[i] ;
sum+= w[i] ;
}
float res = 0 ;
for(int i=0 ; i<n ;i++)
res += arr[i]*w[i] ;
cout << fixed << setprecision(1) << res/sum <<endl ;
}