-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path1079.cpp
42 lines (30 loc) · 960 Bytes
/
1079.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
// https://judge.beecrowd.com/en/problems/view/1079
/*
Time Complexity =>
Space Complexity =>
*/
#include <bits/stdc++.h>
using namespace std;
const double FIRST_NUMBER_WEIGHT = 2;
const double SECOND_NUMBER_WEIGHT = 3;
const double THIRD_NUMBER_WEIGHT = 5;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
ifstream input("input.txt");
ofstream output("output.txt");
int N = 0;
cin >> N;
double firstNumber = 0, secondNumber = 0, thirdNumber = 0;
for (int i = 0; i < N; i++) {
cin >> firstNumber >> secondNumber >> thirdNumber;
double sum = (firstNumber * FIRST_NUMBER_WEIGHT) +
(secondNumber * SECOND_NUMBER_WEIGHT) +
(thirdNumber * THIRD_NUMBER_WEIGHT);
double average = sum / (FIRST_NUMBER_WEIGHT + SECOND_NUMBER_WEIGHT +
THIRD_NUMBER_WEIGHT);
cout << fixed << setprecision(1) << average << endl;
}
return 0;
}