Search found 26 matches

by Mahbub
Thu Nov 28, 2002 3:10 pm
Forum: Volume 3 (300-399)
Topic: 378 - Intersecting Lines
Replies: 48
Views: 15296

#include <stdio.h> double det (double a11, double a12, double a21, double a22) { return a11 * a22 - a12 * a21; } double main() { int N; double d,area,x1,x2,y1,y2,x3,y3,x4,y4; double x,y; scanf ( "%d", &N ); printf ( "INTERSECTING LINES OUTPUT\n" ); while ( N-- ) { scanf ( "%lf %lf %lf %lf", &x1, &y...
by Mahbub
Tue Nov 19, 2002 9:47 am
Forum: Other words
Topic: Mr. Mahbub, would u plz help me !!!
Replies: 2
Views: 1463

I dont really know why u asked me for that? Or is it me u meant by "Mr.Mahbub" ?

I am sorry if u didnt meant me by that by name. But if u indeed ask me tha question my answer is tha same as the prevous reply made by somebody named 'suman' in this topic.

Thanks
Light
by Mahbub
Mon Nov 18, 2002 2:05 pm
Forum: Volume 3 (300-399)
Topic: 371 - Ackermann Functions
Replies: 196
Views: 28612

Well Sending Table will certainly have faster run but i am really astonished why a time limit question arises: As i resend my code today i get acc in .00.555 seconds. I think this is not bad. #include<stdio.h> unsigned long i,j,temp,n,len,s,ans,max,k,x; int main(){ while(scanf("%lu%lu",&i,&j)==2){ i...
by Mahbub
Sun Nov 10, 2002 3:07 pm
Forum: Volume 104 (10400-10499)
Topic: 10402 - Triangle Covering
Replies: 37
Views: 5673

ATTN : PROBLEMSETTER 10402 (TRIANGLE COVERING)

There is no doubt that t4 = s*4/sqrt(3)...Becoz it is written by the dicoverer of the problem! The result for t2 is s* (4*root(6) - 6*root(2)) which is also as stated by David Candrell... So the prob is for t3 and t6..where he stated that t3 = 2.108+ and t6 = 3.168+..which do not hav analytic soluti...
by Mahbub
Sun Nov 10, 2002 3:04 pm
Forum: Volume 104 (10400-10499)
Topic: 10402 - Triangle Covering
Replies: 37
Views: 5673

ATTN : PROBLEMSETTER

There is no doubt that t4 = s*4/sqrt(3)...Becoz it is written by the dicoverer of the problem! The result for t2 is s* (4*root(6) - 6*root(2)) which is also as stated by David Candrell... So the prob is for t3 and t6..where he stated that t3 = 2.108+ and t6 = 3.168+..which do not hav analytic soluti...
by Mahbub
Sun Nov 10, 2002 8:06 am
Forum: Volume 100 (10000-10099)
Topic: 10003 - Cutting Sticks
Replies: 59
Views: 24356

Hi, Did u notice that this is a simple example of "Matrix Chain Mutiplcation" dp algorithm? In case u have used that and still getting TLE...u may find this code helpful :) #include<stdio.h> #include<values.h> #define MAX 60 #define inf MAXLONG int main() { long L,N,i,j,n,x,y,q,l,k,t,sum,m[MAX][MAX]...
by Mahbub
Thu Nov 07, 2002 6:16 am
Forum: Volume 100 (10000-10099)
Topic: 10008 - What's Cryptanalysis?
Replies: 55
Views: 17366

#include <stdio.h> #include <stdlib.h> #define MAX 1000000 char a[27] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; int f[27]; char s[MAX]; int cmpf(const void *a, const void *b) { char *x = (char *)a; char *y = (char *)b; if(f[*x-65]!=f[*y-65]) return f[*y-65] - f[*x-65]; return *x - *y; } int main() { int n,i,...
by Mahbub
Thu Nov 07, 2002 6:13 am
Forum: Volume 100 (10000-10099)
Topic: 10020 - Minimal coverage
Replies: 57
Views: 20585

10020 - Minimal coverage

Wats the idea?

I got WA in greedy approach :
Always taking the line with highest end_x which has a lower left_index than curent covered length..

Thanks
Light
by Mahbub
Thu Nov 07, 2002 5:30 am
Forum: Volume 103 (10300-10399)
Topic: 10374 - Election
Replies: 44
Views: 15030

As this problem has really no trick i think its not bad idea to post my code her... u can compare ur output with mines..(by fc or else.) #include <stdio.h> #include <string.h> #include <stdlib.h> struct S { char cand[100]; char party[100]; int vote; } list[20000]; int cmpf(const void *a, const void ...
by Mahbub
Wed Nov 06, 2002 9:10 am
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 182820

Input can be like
3 2
100 1

That is first > last...in that case u need to swap while finding the max value.
But be careful to print 'first' and 'last' (as per ur code) according to input serial (not swapped..:)).

Thats all
Light
by Mahbub
Wed Nov 06, 2002 8:56 am
Forum: Volume 103 (10300-10399)
Topic: 10306 - e-Coins
Replies: 9
Views: 5865

It may sound srtange to many but this problem has a faster(!) solution than DP , in BFS!! Here is my code :>> U can perform I/O check with it.. #define MAX 301 #define QMAX 20000 #define EMAX 41 struct Point { int x; int y; }; int main() { int c,case_no,i,s,m,head,tail,found; Point e[EMAX]; /* freop...
by Mahbub
Wed Nov 06, 2002 5:59 am
Forum: Volume 3 (300-399)
Topic: 371 - Ackermann Functions
Replies: 196
Views: 28612

Ya it can be shorten. As i use c++ i am putting a pseudocode here: Let the interval is i......j max <-- 0 for i = i to j do s <-- i len <-- 1 while s not equal to 1 do if ( s is odd ) s <-- s / 2 + 1 len <-- len + 2 /*-Tricky PArt -*/ else s <-- s / 2 len <-- len + 1 if ( i = 1 ) len <-- 4 max <-- M...
by Mahbub
Wed Nov 06, 2002 5:40 am
Forum: Volume 103 (10300-10399)
Topic: 10386 - Circles in Triangle
Replies: 5
Views: 2640

Well..this is a liiltle odd for me to describe things without a figure.. If u had correctly assumed about the red and green line ..> the side of trinagle = s; s = 4 * (2r) * cos (A) + 2 * d d = distance from the touch point of { bottom right circle with base of triangle} to the right corner of the t...
by Mahbub
Tue Nov 05, 2002 3:19 pm
Forum: Volume 3 (300-399)
Topic: 376 - More Triangles ... THE AMBIGUOUS CASE
Replies: 10
Views: 4870

Output Format!!!!:((((((((

Can any one tell me exactly wats the ouput format??
I mean how many gaps between the words ?
Or wats the value for a, b in print (%a.blf)...

I think it will be easier if someone can give me printing part of his/her code..:)

Thanks
Light.
by Mahbub
Tue Nov 05, 2002 2:17 pm
Forum: Volume 103 (10300-10399)
Topic: 10398 - The Golden Pentagon
Replies: 17
Views: 3847

Thanks to Adrian. But i was actually getting WA for a silly stupid mistake.
Thanks. I got acc now

Light.

Go to advanced search