Search found 14 matches

by adnan2nd
Thu Dec 27, 2007 10:18 am
Forum: Volume 110 (11000-11099)
Topic: 11037 - Point of View in Flatland
Replies: 15
Views: 7845

-0.00 lines circles

thanks to little joey for -0.00 case.

it can be handled like this

Code: Select all

void print(double a, double b)
	{
	  if(a<0.005 && a>-0.005) a=0;
    if(b<0.005 && b>-0.005) b=0;
    printf("%.2lf %.2lf\n",a,b);	
	
	}
in C.
Circles and Lines were enough (in my AC code-position 2(may be for new judge)) .
by adnan2nd
Sat Oct 22, 2005 8:58 am
Forum: Volume 109 (10900-10999)
Topic: 10947 - Bear with me, again..
Replies: 23
Views: 2991

Then how can I convert the following

Code: Select all

dist=sqrt(pow(x1-x2,2)+pow(y1-y2,2));
		
		if(fabs(dist-r1-r2-limit)<.000000001) g[i][j]=g[j][i]=1;
		else if(floor(dist-r1-r2)<limit) g[i][j]=g[j][i]=1;
into correct comarison. dist-r1-r2 is to be compared with limit. r1,r2 are integers.
by adnan2nd
Sat Oct 22, 2005 7:22 am
Forum: Volume 109 (10900-10999)
Topic: 10947 - Bear with me, again..
Replies: 23
Views: 2991

but how?
the distance can be non-integer.
by adnan2nd
Fri Oct 07, 2005 12:39 pm
Forum: Volume 103 (10300-10399)
Topic: 10301 - Rings and Glue
Replies: 50
Views: 16277

chok's 1st algorithm was wrong.
if there r 4 rings, and (1,3) ,(2,3),(2,4) are coonected pair answer should be 4, not 3.
set union- is OK.
by adnan2nd
Fri Oct 07, 2005 12:21 pm
Forum: Volume 103 (10300-10399)
Topic: 10301 - Rings and Glue
Replies: 50
Views: 16277

try this input

Code: Select all

4
0.0 0.0 1.0
0.0 2.1 1.0
0.0 .5 1.0
-2.0 2.0 3.5
output should be

Code: Select all

The largest component contains 4 rings.
your code gives 3 rings.
ur algorithm is wrong.If ring pair(1, 3) and ring pair(2, 3) is connected 1,3 are also connected. Try dfs, or set union.

bye
by adnan2nd
Thu Oct 06, 2005 3:42 pm
Forum: Volume 103 (10300-10399)
Topic: 10394 - Twin Primes
Replies: 101
Views: 32358

Thanks rocky and larry.
I got accepted.
by adnan2nd
Thu Sep 29, 2005 12:19 pm
Forum: Volume 103 (10300-10399)
Topic: 10394 - Twin Primes
Replies: 101
Views: 32358

10394 , Time limit exceeded

My code is running in 1 sec for 100000, my pc has 256MB of ram. but giving TLE.please anyone help. #include<stdio.h> #include<math.h> bool pr[20000000]={0}; main() { unsigned long count,m,i,n,j,k; double sq; if(19999999%2==0) n=19999999/2-1;/*there are n odd numbers from 3 to 19999999*/ else n=19999...
by adnan2nd
Sun May 01, 2005 11:15 am
Forum: Volume 4 (400-499)
Topic: 436 - Arbitrage (II)
Replies: 17
Views: 5214

thanks eduard. you have found the error. i fixed it and got accepted,before. The turbo c++ didn't show any compiletime error! but visual c++ showed.
In hurry i forgot to type the j loop.
by adnan2nd
Sun Apr 24, 2005 7:45 am
Forum: Volume 4 (400-499)
Topic: 436 - Arbitrage (II)
Replies: 17
Views: 5214

436-arbitrage-runtime error plz help.

My C code is getting runtime error. please some give a hint. #include<stdio.h> #include<string.h> main() { int d=0,found,m,i,j,k,n,in1,in2; char name[31][500],x[500],y[500]; float c,g[31][31],max; while(1) { scanf("%d",&n); if(n==0) break; for(i=1;i<=n;i++) { if(i==j) g[i][j]=1; else g[i][j]= 0; } f...
by adnan2nd
Wed Mar 23, 2005 10:29 am
Forum: Volume 7 (700-799)
Topic: 729 - The Hamming Distance Problem
Replies: 54
Views: 15572

Flonav,
Your program takes sevarel test cases and gives the output of the 1st case. This is wrong.when the 1st input is, suppose 5 2, after pressing Enter
just after 2 the output should be in the standard output. May be you have tested with file.
by adnan2nd
Wed Dec 01, 2004 2:01 pm
Forum: Volume 7 (700-799)
Topic: 793 - Network Connections
Replies: 102
Views: 31015

793 the dfs giving WA,Why?

I tried with the following code,based on dfs. what is the critical input with respect to my code. Some please help me. C code: #include<stdio.h> void dfs(int v); int a,b,f,n,adj[1001][1001],len[1001],color[1001]; void dfs(int v) { int i,w; color[v]=1; if(v==b) f=1; if(f==1) return; for(i=1;i<=len[v]...
by adnan2nd
Sun Jul 04, 2004 8:48 am
Forum: Volume 1 (100-199)
Topic: 101 - The Blocks Problem
Replies: 635
Views: 38549

This is simple stack operation,pop push. Try mine,. #include<stdio.h> #include<string.h> int n; struct stack { int top; int boxes[24]; } s[25]; void init() { int i; for(i=0;i<n;i++) { s .top=0; s .boxes[0]=i; } s[24].top=-1; } void push(int i,int x) { s .top++; s .boxes[s .top]=x; } int pop(int i) {...
by adnan2nd
Sat Jul 03, 2004 2:15 pm
Forum: Volume 1 (100-199)
Topic: 101 - The Blocks Problem
Replies: 635
Views: 38549

Not read ur code

I don't have time. This problem is a stack operation.Just push and pop.Giving my code . Compare.Sorry wait.
by adnan2nd
Sat Jul 03, 2004 1:44 pm
Forum: Volume 100 (10000-10099)
Topic: 10034 - Freckles
Replies: 101
Views: 32395

10034 P.E.?

I am getting presentation error WHY????? Done by prims algo. Code: #include<stdio.h> #include<math.h> main() { int t[100][2],nr[101],n,m,i,j,k; unsigned long c; float cost[101][101]; float x[101],y[101],x1,y1; float min,temp; scanf("%lu",&c); while(c) { min=0.0;c--; scanf("%d",&n); for(i=1;i<=n;i++)...

Go to advanced search