the problem is about coin change - "how many ways you can change 3,5,10 dollars if you have 5c,10c ...... "http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=83 the problem is solved many times on various blogs( solution [here](http://jijingshanlin.blogspot.ca/2012/07/147-dollars.html) ) In dp, the hardest thing is to understand the relation between subproblems and get the formula(optimal substructure) I only give the actual for loop that stores the ways into 2d table like the solution: for (int i = 2; i <= NCHANGES; ++i){ for (int m = 1; m <= MAX_AMOUNT; ++m){ if (m >= coins[i]) n[i][m] = n[i-1][m] + n[i][m - coins[i]]; else n[i][m] = n[i-1][m]; … |
+0 forum
1 | ||

A solution for the "Hartals" problem. Problem description: http://icpcres.ecs.baylor.edu/onlinejudge/external/100/10050.html Author: [Joana Matos Fonseca da Trindade](http://joanatrindade.wikidot.com) #include<stdio.h> int main() { int i,j,k,a,b,h,hd[100000],n,p,pd[150],tc,t,s; while(scanf("%d",&tc)==1) { for(i=0;i<tc;i++) { h=0; s=0; scanf("%d",&n); scanf("%d",&p); for(j=0;j<p;j++) scanf("%d",&pd[j]); for(j=0;j<p;j++) for(k=pd[j];k<=n;k+=pd[j]) if(k%7!=0 && k%7!=6) { h++; hd[h-1]=k; } for(a=1;a<h;a++) for(b=h-1;b>=a;b--) if(hd[b-1]>hd[b]) { t=hd[b-1]; hd[b-1]=hd[b]; hd[b]=t; } for(t=1;t<h;t++) if(hd[t]==hd[t-1]) s++; printf("%d\n",h-s); } } } |
+0 forum
0 | ||

[URL="http://www.smh.com.au/news/technology/facebook-friends-not-real-judge/2008/03/27/1206207279597.html"]According to a report by the Sydney Morning Herald[/URL] a UK judge has ruled, as part of a harassment case, that being a Facebook friend is not the same as being a real friend. The case revolved around a woman claiming that the act of sending a Facebook friend request was enough to prove that her ex-boyfriend was in fact harassing her. The former boyfriend countered the claim by arguing that a popular British radio DJ, Chris Moyles, has 1 million Facebook friends but probably knows very few, if any, of them intimately. How refreshing, of late, to read a … |
+0 forum
0 |

The End.