CSES - Datatähti 2017 loppu - Results
Submission details
Task:Ohjelma
Sender:Senpai
Submission time:2017-01-19 13:36:19 +0200
Language:C++
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:13:1: error: 'else' without a previous 'if'
 else if((n%2==1 && n-3>=1) || n==4){n=n-3;
 ^

Code

#include <bits/stdc++.h>
using namespace std;
int n,d;
vector<int>v;
int main(){
cin>>n;
vector<string>m(3);
m[0]="ADD";
m[1]="MUL";
m[2]="END";

while(n>1){
else if((n%2==1 && n-3>=1) || n==4){n=n-3;
v.push_back(1);}
if(n%2==0){n/=2;
v.push_back(0);}

else{cout<<0;
return 0;}
}
v.push_back(2);
d=v.size();
cout<<d<<"\n";
for(int i=0; i<d; i++){
cout<<m[v[i]]<<"\n";
}
}