Search found 42 matches

by rakeb
Mon Apr 14, 2003 12:01 pm
Forum: Volume 101 (10100-10199)
Topic: 10131 - Is Bigger Smarter?
Replies: 93
Views: 63542

i think the most easiest way is to first sort the data in W[a[1]] < W[a[2]] < ... < W[a[n]] and S[a[1]] > S[a[2]] > ... > S[a[n]] order.Then do the LSS algorithm. This may not give u the sample output but u will get ac :)
by rakeb
Mon Dec 23, 2002 4:43 pm
Forum: Algorithms
Topic: How to generate unique permutation
Replies: 2
Views: 2709

u can also use the next permutation algorithm given in discrecte math book of kenneth h. rosen ( 4th edition ) at page 298 to find the next permutation


http://www.mhhe.com/math/advmath/rosen/
by rakeb
Sun Dec 22, 2002 1:24 pm
Forum: Volume 1 (100-199)
Topic: 191 - Intersection
Replies: 103
Views: 17219

191 Intersection Why WA? plz give me some test data

Here is my code. i don't know why it gets wa. can anybody help? [c] #include <stdio.h> #define left 1 #define right -1 #define colen 0 struct D { int x,y; }; int orien(D a,D b,D c) { int z; z=(b.x-a.x)*(c.y-a.y)-(c.x-a.x)*(b.y-a.y); if(z > 0) return left; if(z < 0) return right; return colen; } int ...
by rakeb
Sun Dec 08, 2002 11:57 am
Forum: Volume 1 (100-199)
Topic: 102 - Ecological Bin Packing
Replies: 485
Views: 30862

Re: Re: P 102 - Worg answer, why ?

[quote="passwd"]
but I don
by rakeb
Sat Dec 07, 2002 6:17 pm
Forum: Volume 1 (100-199)
Topic: 102 - Ecological Bin Packing
Replies: 485
Views: 30862

Re: P 102 - Worg answer, why ?

hi, I'm trying to solve problem 102 , but I'm getting wrong answer and I don't know why , it seem to be correct ... I'm sendind the source code, please, if someone can help me ... [c] min=bcg; if(bgc<min) { min=bgc; seq[0]='B'; seq[1]='G'; seq[2]='C'; }; if(cbg<min) { min=cbg; seq[0]='C'; seq[1]='B...
by rakeb
Wed Dec 04, 2002 6:04 am
Forum: Volume 1 (100-199)
Topic: 125 - Numbering Paths
Replies: 56
Views: 5338

125-Numbering Paths PLZ help

i just used allpair shortest path but giving me WA,is there any tricky case. can anybody help my code: #include <stdio.h> #include <values.h> #define size 35 int m[size][size]; void allpair(int n) { int i,j,k; for(k=0;k<=n;k++) { for(i=0;i<=n;i++) { if(i!=k) { for(j=0;j<=n;j++) { //if(j!=k && i!=j) ...
by rakeb
Mon Dec 02, 2002 8:10 pm
Forum: Volume 103 (10300-10399)
Topic: 10377 - Maze Traversal
Replies: 26
Views: 9451

Re: acm-10377=>about P.E.

I got P.E. Accepted,but I still can't find the wrong with the P.E. problem.. Could somebody excute my source code and find my wrong..thanks!! ps.I think this blank lines are troubles........... scanf("%d",×); printf("\n"); while(times-->0) { ---------------------------------- -----------------...
by rakeb
Fri Nov 22, 2002 5:54 pm
Forum: Volume 3 (300-399)
Topic: 392 - Polynomial Showdown
Replies: 93
Views: 17217

392 PLZ Help

What will be the out put if all inputs are zero
i.e.
0 0 0 0 0 0 0 0 0
unless all terms have zero coefficients in which case the constant term should appear
what is this line meaning i can't understand.....

Thanks
by rakeb
Thu Nov 21, 2002 2:10 pm
Forum: Volume 4 (400-499)
Topic: 401 - Palindromes
Replies: 196
Views: 29706

i think you done too much to chek the mirror just define normal and mirrored charecters in two strings [cpp] char Char[22]="AEHIJLMOSTUVWXYZ12358"; char Revers[22]="A3HILJMO2TUVWXY51SEZ8"; [/cpp] then build another string b[100] by the mirrored charecters of original charecters. then compare them, i...
by rakeb
Thu Nov 21, 2002 1:29 pm
Forum: Volume 103 (10300-10399)
Topic: 10397 - Connect the Campus
Replies: 75
Views: 24849

as i told before i think there is something wrong with ur MST algorithm try this one [cpp] struct ed { long src,dst; double cost; }h[10000000],zero; double m[1000][1000]; long parent[1000],tree[1000][2]; void insert(ed x,long n) { long i=n; while(i>1 && h[i/2].cost>x.cost) { h =h[i/2]; i/=2; } h =x;...
by rakeb
Wed Nov 20, 2002 7:04 am
Forum: Volume 4 (400-499)
Topic: 484 - The Department of Redundancy Department
Replies: 103
Views: 7971

Because scanf stops input after getting space, here you can take input by scanf and sore it in an array. u should take input as a string and then by searching the array give the output here is my code: [cpp] #include<stdio.h> #include<string.h> struct d { char a[100]; long num; }data[100]; long nc; ...
by rakeb
Wed Nov 20, 2002 5:39 am
Forum: Volume 103 (10300-10399)
Topic: 10393 - The One-Handed Typist
Replies: 40
Views: 10595

sorry, the first line of input will be 3 19
by rakeb
Wed Nov 20, 2002 5:34 am
Forum: Volume 103 (10300-10399)
Topic: 10393 - The One-Handed Typist
Replies: 40
Views: 10595

i think for the input:
3 18
7 8 9
weaves
waxers
waxed
waxen
waxer
waxers
waxes
waxing
waxy
we
wear
wearable
wearer
wearing
wears
weave
weaver
weaves
weaving

output is:
4
waxers
wearer
weaver
weaves
BUT YOUR PROGRAM GIVES:
5
waxers
wearer
weaver
weaves
by rakeb
Fri Nov 15, 2002 3:29 pm
Forum: Volume 103 (10300-10399)
Topic: 10397 - Connect the Campus
Replies: 75
Views: 24849

i am not too sure about ur MST algorithm, i think it's better you use kruskal or prim. i assigned cost 0.0 for the existing cables and used kruskal. [cpp] scanf("%ld",&nc); while(nc--) { scanf("%ld%ld",&i,&j); m [j]=0.0; } [/cpp] INPUT: 6 0 0 200 50 100 200 50 300 300 200 300 300 2 3 4 5 6 6 0 0 200...
by rakeb
Fri Nov 15, 2002 2:42 pm
Forum: Volume 4 (400-499)
Topic: 497 - Strategic Defense Initiative
Replies: 144
Views: 20159

What is wrong with this code can anybody help plz [cpp] //misile "dynamic prloblem" #include<stdio.h> #include<values.h> #include<string.h> #define inf MAXLONG-2 long hit[1000]; long hight[1000]; void show(long max,long i,long ph) { long k; for(k = i;k > 0;k--) { if(hit[k] == max) { if(ph > hight[k]...

Go to advanced search