Advertisement
Jvsierra

Problema algar telecom

Mar 17th, 2018
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. https://www.youtube.com/watch?v=0tuo9rHKvsM
  2.  
  3. #include <stdio.h>
  4.  
  5. int main()
  6. {
  7. int n, tempo, tempo_total = 0, i, acertos = 0;
  8. char prob, av, atual_errado = ' ';
  9.  
  10. scanf("%d", &n);
  11.  
  12. while(n != 0)
  13. {
  14. for(i = 0; i < n; i++)
  15. {
  16. fflush(stdin);
  17. scanf("%c", &prob);
  18. scanf("%d", &tempo);
  19. fflush(stdin);
  20. scanf("%c", &av);
  21.  
  22. if(av == 'I' || av == 'i')
  23. atual_errado = prob;
  24. else
  25. {
  26. if(atual_errado == prob)
  27. tempo_total += 20;
  28.  
  29. tempo_total += tempo;
  30.  
  31. acertos++;
  32. }
  33. }
  34.  
  35. printf("%d %d\n", acertos, tempo_total);
  36.  
  37. acertos = 0;
  38. tempo_total = 0;
  39. atual_errado = ' ';
  40.  
  41. scanf("%d", &n);
  42. }
  43.  
  44. return 0;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement