Advertisement
Guest User

pro2

a guest
Mar 2nd, 2015
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.77 KB | None | 0 0
  1. #include "EdgarGay"
  2. #include "utils.PRO2"
  3. #include "Estudiant.hh"
  4. #include <vector>
  5.  
  6. void omplim_v (vector <bool> &v, int Ass) {
  7.  for (int i = 0; i < Ass; ++i) {
  8.    int pos = readint();
  9.    v[pos-1] = true;
  10.  }
  11. }
  12.  
  13. double tractament (const vector <bool> &v, int nomAss,int Ass) {
  14.     double suma = 0;
  15.     for (int j = 0; j < nomAss; ++j) {
  16.       double nota = readdouble();
  17.       if (v[j]) {
  18.     suma += nota;
  19.       }
  20.       }
  21.   suma = suma/Ass;
  22.   return suma;
  23. }
  24.  
  25. int main() {
  26.  int nomEst, nomAss, Ass;
  27.  nomEst = readint();
  28.  nomAss = readint();
  29.  Ass = readint();
  30.  vector <bool> v(nomAss, false);
  31.  omplim_v(v,Ass);
  32.  for (int i = 0; i < nomEst; ++i) {
  33.     int dni = readint();
  34.     double nota = tractament(v,nomAss,Ass);
  35.     cout << dni << " " << nota << endl;
  36.   }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement