Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /******************************************************************************
- Online C++ Compiler.
- Code, Compile, Run and Debug C++ program online.
- Write your code in this editor and press "Run" button to compile and execute it.
- *******************************************************************************/
- #include <iostream>
- #include <cmath>
- #include <string>
- using namespace std;
- int rep(int n){
- int x, endx = 0;
- // if (n==0){
- // return endx;
- // }
- string s;
- cin >> s;
- while (s!="BLE"){
- if (s=="MOV"){
- cin >> x;
- endx+=x;
- }
- if (s=="REP"){
- cin >> x;
- cin >> s;
- endx+=rep(x);
- }
- cin >> s;
- }
- return endx*n;
- }
- int main()
- {
- string s;
- int x, endx=0;
- while(cin >> s){
- if (s=="MOV"){
- cin >> x;
- endx+=x;
- }
- if (s=="REP"){
- cin >> x;
- cin >> s;
- endx+=rep(x);
- }
- }
- cout << endx;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement