CSES - Datatähti Open 2017 - Results
Submission details
Task:Program
Sender:Raivis
Submission time:2017-01-22 13:12:47 +0200
Language:C++
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:13:13: error: expected ';' before 'V'
             V.push_back(1);
             ^

Code

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
int main()
{
    vector <ll> V;
    ll n;
    cin>>n;
    while(n>1){
        if(n==4){
            n=1
            V.push_back(1);
            break;
        }
        if(n%2==0){
            n=n/2;
            V.push_back(0);
        }else{
            n=n-3;
            V.push_back(1);
        }
    }
    if(n==1){
        cout<<V.size()+1<<"\n";
        for(ll i=V.size()-1;i>=0;i--){
            if(V[i]==0)cout<<"MUL\n";
            else cout<<"ADD\n";
        }
        cout<<"END";
    }else cout<<0;
}