Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <vector>
- using namespace std;
- int main() {
- int iN, iM, iAux, iTiempo = 0, iUbicacion = 1;
- vector<int> vTasks;
- scanf("%i", &iN);
- scanf("%i", &iM);
- while (iM > 0) {
- scanf("%i", &iAux);
- vTasks.push_back(iAux);
- iM--;
- }
- for (int i = 0; i < vTasks.size(); i++) {
- while (vTasks[i] != iUbicacion) {
- iTiempo++;
- iUbicacion++;
- if (iUbicacion > iN) {
- iUbicacion = 1;
- }
- }
- }
- printf("%i\n", iTiempo);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement