Advertisement
Guest User

Untitled

a guest
Feb 28th, 2015
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. int main() {
  6. int iN, iM, iAux, iTiempo = 0, iUbicacion = 1;
  7. vector<int> vTasks;
  8. scanf("%i", &iN);
  9. scanf("%i", &iM);
  10.  
  11. while (iM > 0) {
  12. scanf("%i", &iAux);
  13. vTasks.push_back(iAux);
  14. iM--;
  15. }
  16.  
  17. for (int i = 0; i < vTasks.size(); i++) {
  18. while (vTasks[i] != iUbicacion) {
  19. iTiempo++;
  20. iUbicacion++;
  21. if (iUbicacion > iN) {
  22. iUbicacion = 1;
  23. }
  24. }
  25. }
  26.  
  27. printf("%i\n", iTiempo);
  28.  
  29.  
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement