fork download
  1. #include <iostream>
  2. #include <iomanip>
  3. using namespace std;
  4.  
  5. int main(int argc, char const *argv[])
  6. {
  7. int fidelcastroLol;
  8. char juveno;
  9. cin >> fidelcastroLol, juveno;
  10. float matriz[12][12];
  11.  
  12. for (int i=0; i<12; i++) {
  13. for (int j=0; j<12; j++) {
  14. cin >> matriz[i][j];
  15. }
  16. }
  17.  
  18.  
  19. float resultado = 0.0;
  20.  
  21. for (int i=0; i<12; i++) {
  22. if (juveno == 'S') {
  23. resultado += matriz[fidelcastroLol][i];
  24. } else if (juveno == 'M') {
  25. resultado += matriz[fidelcastroLol][i]/12;
  26. }
  27. }
  28.  
  29.  
  30.  
  31.  
  32.  
  33. cout << fixed << setprecision(1) << resultado << endl;
  34.  
  35. return 0;
  36. }
  37.  
Success #stdin #stdout 0.01s 5380KB
stdin
2
S
0.0
-3.5
2.5
4.1
stdout
0.0