Task: | Ohjelma |
Sender: | Senpai |
Submission time: | 2017-01-19 13:32:49 +0200 |
Language: | C++ |
Status: | COMPILE ERROR |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:22:22: error: expected ')' before '{' token for(int i=0; i<d; i++{ ^
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){ if(n%2==0){n/=2; v.push_back(0);} else if(n%2==1 && n-3>=1){n=n-3; v.push_back(1);} else{cout<<0; return 0;} } d=v.size(); cout<<d<<"\n"; for(int i=0; i<d; i++{ cout<<m[v[i]]<<"\n"; } }