×

# SUMTHING INOI PRACTICE SERVER

 0 i have attached my code for sumthing. i am getting 30/100. please find errors. #include #include #include #include #include  using namespace std; int n;long long int t;int tab[55][100005];string arr; vector v; int dp(int endnum,long long int val) {  if(!endnum) { if(val==v[0]) return 0; else return -1; } int vs=55; if(tab[endnum][val]>=0) return tab[endnum][val]; for(int j=endnum-1;j>=-1;j--) { long long int sub=0; for(int k=endnum;k>=j+1;k--) sub+=(v[k]*pow(10,endnum-k)); long long int pass=val-sub; if(pass>=0&&j!=-1) { if(tab[j][pass]>=0) return tab[j][pass]; tab[j][pass]=1+dp(j,pass); vs=min(vs,tab[j][pass]); } else if(j==-1&&pass>=0) { if(sub==val) return 0; else return -1; } else break; } if(vs>n) return -1; tab[endnum][val]=vs; return vs;  } int main() { ios::sync_with_stdio(0); cin>>n; cin>>arr; cin>>t; for(int i=0;i<55;++i) for(int j=0;j<100004;++j) tab[i][j]=-1; for(int i=0;i

 0 I am getting 30/100 too. I don't think my solution is wrong. Did anyone get 100/100? answered 27 Jan '15, 14:56 6★ketanhwr 1.9k●3●18●44 accept rate: 15% Yeah. I don't remember what I did though. I think it was something like knapsack, but not sure http://paste.ubuntu.com/9895423/ If you aren't able to get it I'll try to look through and recollect (27 Jan '15, 15:07) superty3★
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×2,212

question asked: 25 Jan '15, 17:43

question was seen: 2,745 times

last updated: 27 Jan '15, 15:08