Search found 10 matches

by prom
Tue Mar 04, 2003 10:37 pm
Forum: Volume 104 (10400-10499)
Topic: 10465 - Homer Simpson
Replies: 75
Views: 23392

I know what's wrong. If Simpson has to drink some beer, then th time of drinking shuld be minimized :)
by prom
Tue Mar 04, 2003 10:02 pm
Forum: Volume 104 (10400-10499)
Topic: 10465 - Homer Simpson
Replies: 75
Views: 23392

10465 - Homer Simpson

[cpp] #include <iostream.h> #include <string.h> #define min(a,b)(a<b ? a : b) #define MAX 10005 int tt[MAX]; int main(){ int m,n,t; while (cin >> m >> n >> t){ memset(tt,0,4*(t+1)); tt[m]=(m!=0); tt[n]=(n!=0); int i=min(m,n); while (i<=t) { if (tt ){ if (i+m<=t && tt +1>tt[i+m] ) tt[i+m]=tt +1; if (...
by prom
Sun Mar 02, 2003 5:08 pm
Forum: Volume 104 (10400-10499)
Topic: 10453 - Make Palindrome
Replies: 38
Views: 15640

Consider a string x1x2x3...xn, s[1,n] is our optimal solution, then s[m,n] = s[m+1,n-1], if xm=xn, min(s[m+1,n],s[m,n-1])+1, otherwise Maybe it is not exacly optimal matrix chain multiplication, but method of solving is similiar. optimal matrix chain multiplication is O(n^3) . Hope this helps.
by prom
Sun Mar 02, 2003 12:14 pm
Forum: Volume 104 (10400-10499)
Topic: 10453 - Make Palindrome
Replies: 38
Views: 15640

this problem is very similiar to well known problem -- optimal matrix multiplication
by prom
Tue Oct 29, 2002 1:49 am
Forum: Volume 103 (10300-10399)
Topic: 10375 - Choose and divide
Replies: 23
Views: 11752

10375 - Choose and divide

[cpp] #include <iostream.h> #include <math.h> int a,b; int p,q,r,s; long double sum; int main(){ cout.setf(ios::fixed); cout.precision(5); while (cin >> p >> q >>r >>s){ a=p-q; b=r-s; sum=0.0; for (int i=2;i<=p;++i) sum+=log10((long double)i); for (int i=2;i<=q;++i) sum-=log10((long double)i); for (...
by prom
Fri Sep 13, 2002 10:40 pm
Forum: Volume 100 (10000-10099)
Topic: 10056 - What is the Probability ?
Replies: 26
Views: 8426

Test for you
1
100 0 4
by prom
Sun Aug 18, 2002 1:10 am
Forum: Volume 102 (10200-10299)
Topic: 10219 - Find the ways !
Replies: 33
Views: 10563

10219 - Find the ways !

Could somone look in my code and tell me what's wrong. [cpp] #include <math.h> #include <iostream.h> #define MIN(a,b) (a<b ? a : b) int s(int p, int k){ double s=0.0; for (int i=p;i<=k;++i) s+=log10(i); return (int)(ceil(s)); } int main(){ int n,k,m1,m2; while (cin >> n >>k){ if (k<=n-k) {m1=k; m2=n...
by prom
Fri Jul 26, 2002 5:40 pm
Forum: Volume 103 (10300-10399)
Topic: 10329 - Combinatorial Expression
Replies: 11
Views: 6108

Fixed. Thank you Adrian for quick help :D .
by prom
Fri Jul 26, 2002 10:01 am
Forum: Volume 103 (10300-10399)
Topic: 10329 - Combinatorial Expression
Replies: 11
Views: 6108

My program wrote correct answer. Here is my code : [c] #include <string.h> #include <math.h> #include <stdio.h> #define MAX(a,b)(a<b ? b: a) #define MIN(a,b)(a<b ? a: b) #define MAXLC 100 int l1[MAXLC],l3[MAXLC]; char c[]={128,64,32,16,8,4,2,1}; char br[5001]={0}; int rr[5001][80]={{0}}; int ir[5001...
by prom
Fri Jul 26, 2002 12:06 am
Forum: Volume 103 (10300-10399)
Topic: 10329 - Combinatorial Expression
Replies: 11
Views: 6108

10329 - Combinatorial Expression

I can't find bug in my solution :( . Could somebody send me some tests ?

Go to advanced search