Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "EdgarGay"
- #include "utils.PRO2"
- #include "Estudiant.hh"
- #include <vector>
- void omplim_v (vector <bool> &v, int Ass) {
- for (int i = 0; i < Ass; ++i) {
- int pos = readint();
- v[pos-1] = true;
- }
- }
- double tractament (const vector <bool> &v, int nomAss,int Ass) {
- double suma = 0;
- for (int j = 0; j < nomAss; ++j) {
- double nota = readdouble();
- if (v[j]) {
- suma += nota;
- }
- }
- suma = suma/Ass;
- return suma;
- }
- int main() {
- int nomEst, nomAss, Ass;
- nomEst = readint();
- nomAss = readint();
- Ass = readint();
- vector <bool> v(nomAss, false);
- omplim_v(v,Ass);
- for (int i = 0; i < nomEst; ++i) {
- int dni = readint();
- double nota = tractament(v,nomAss,Ass);
- cout << dni << " " << nota << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement