Solution for ECOO '16 R1 P1 - Pass or Fail in C++


March 17, 2020 0.027250 seconds C++
#include <bits/stdc++.h>
#include <iostream>
#include <math.h>

template<class C>constexpr int sz(const C&c){return int(c.size());}

using ll=long long;constexpr const char nl='\n',sp=' ';

using namespace std;

int main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int wt, wa, wp, wq, n, counter = 0, temp;
    double avg = 0;

	for(int l = 0; l < 10; l++){
		cin >> wt >> wa >> wp >> wq >> n;
		int weights [4] = {wt, wa, wp, wq};
		counter = 0;
    for(int i = 0; i < n; i++){
		avg = 0;
		for(int d = 0; d < 4; d++){			
			cin >> temp;
			avg += temp * (weights[d] * 0.01);
		}
		if(avg >= 50){
			counter++;
		}
	}
	cout << counter << "\n";
}	
	return 0;
}

Editorial


No editorial for this problem. :(

Original Problem


You can view the original page for this problem on the DMOJ.