Last active
January 5, 2016 09:56
-
-
Save MagallanesFito/07e5edc1b8010adbf9af to your computer and use it in GitHub Desktop.
Canguros Problema Preselectivo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <queue> | |
| #define op_io ios_base::sync_with_stdio(0);cin.tie(0); | |
| using namespace std; | |
| int main(){ | |
| op_io | |
| int n,c; | |
| cin>>c>>n; | |
| char comando; | |
| long long actual; | |
| queue<long long> canguros; | |
| while(n--){ | |
| cin>>comando; | |
| switch(comando){ | |
| case 'N': | |
| cin>>actual; | |
| canguros.push(actual); | |
| break; | |
| case 'A': | |
| c-=canguros.front() + 1; | |
| canguros.pop(); | |
| break; | |
| case 'C': | |
| cout << canguros.size() << "\n"; | |
| break; | |
| case 'R': | |
| cout << c << "\n"; | |
| break; | |
| } | |
| } | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment