Search found 17 matches

by sharklu2000
Thu Oct 09, 2003 6:47 am
Forum: Volume 105 (10500-10599)
Topic: 10566 - Crossed Ladders
Replies: 39
Views: 11470

It means that you continues trying the middle of the large number and the small number until you get the root.
by sharklu2000
Thu Oct 09, 2003 5:02 am
Forum: Volume 105 (10500-10599)
Topic: 10563 - Least Squares
Replies: 14
Views: 7228

what do you think the right output to follows

Code: Select all

5 6
?.????
.?.???
??????
??????
??????
your output is

Code: Select all

A.ABBB
.A.BBB
BBBBBB
BBBAAC
BBBAAB
it's wrong.
by sharklu2000
Thu Oct 09, 2003 4:17 am
Forum: Volume 105 (10500-10599)
Topic: 10562 - Undraw the Trees
Replies: 18
Views: 6769

Hi hewei, thank you very much for your input and I get ac now.
by sharklu2000
Wed Oct 08, 2003 9:35 am
Forum: Volume 105 (10500-10599)
Topic: 10562 - Undraw the Trees
Replies: 18
Views: 6769

Thank you for your kindness but my program can also handle this input.
I almost give up. My code is as follows. I simply deal with each line and construct the tree which is a left child right sibling tree. After that I run the forward dfs. Anyone finding out the fault is appreciated.

Code: Select all

cutted
by sharklu2000
Wed Oct 08, 2003 8:51 am
Forum: Volume 105 (10500-10599)
Topic: 10562 - Undraw the Trees
Replies: 18
Views: 6769

I have taken this case into considation. Is there some other trick input?
But thank you all the same. :cry:
by sharklu2000
Wed Oct 08, 2003 6:34 am
Forum: Volume 105 (10500-10599)
Topic: 10562 - Undraw the Trees
Replies: 18
Views: 6769

10562 - Undraw the Trees

My program passed all my input and I really don't know why it always get wa. :evil: Can anybody give me some critical input? Many thanks.
by sharklu2000
Sun Aug 31, 2003 3:27 pm
Forum: Volume 105 (10500-10599)
Topic: 10547 - Hidden Truth in Recurrence
Replies: 7
Views: 2951

if (b[n]) d = (d * k) % m;
change it to d= (d * (k%m)) % m, since d * k may exceed 64 bit range.
by sharklu2000
Sat Aug 30, 2003 7:33 am
Forum: Volume 105 (10500-10599)
Topic: 10545 - Maximal Quadrilateral
Replies: 13
Views: 6247

I tried many times and always get wrong answer. :x I think my algorithm is ok.

Code: Select all

cutted
Can anyone give me some critical input? thanks
by sharklu2000
Tue Aug 26, 2003 2:09 pm
Forum: Volume 105 (10500-10599)
Topic: 10543 - Traveling Politician
Replies: 25
Views: 7149

try this int BFS() { int i; taker=putter=0; node t,temp; t.id=0; t.dis=1; enq(t); while ( taker!=putter) { t=deq(); if ( t.dis>20) return 25; //if ( (t.dis>=k) && t.id==(n-1) ) return t.dis; for(i=0;i<n;i++) if(adj[t.id][i]==1 && i!=t.id ) { temp.id=i; temp.dis=t.dis+1; if(mark[i] == temp.dis) conti...
by sharklu2000
Mon Aug 25, 2003 6:51 pm
Forum: Volume 105 (10500-10599)
Topic: 10539 - Almost Prime Numbers
Replies: 44
Views: 24142

Thanks UFP2161, Larry, Whinii F.
I got acc with 0.4se now.
by sharklu2000
Mon Aug 25, 2003 1:49 pm
Forum: Volume 105 (10500-10599)
Topic: 10539 - Almost Prime Numbers
Replies: 44
Views: 24142

Hi Larry, what do you mean by using sieve first. :oops:
Is it precomputing all the primes in the range?
Could you tell more in detail about sieve? Thanks.
by sharklu2000
Mon Aug 25, 2003 10:59 am
Forum: Volume 104 (10400-10499)
Topic: 10480 - Sabotage
Replies: 8
Views: 5594

I know Max-flow, but it only calculates the minimum number of edges
to cut. How can I know the minimum cost?
by sharklu2000
Mon Aug 25, 2003 8:56 am
Forum: Volume 105 (10500-10599)
Topic: 10539 - Almost Prime Numbers
Replies: 44
Views: 24142

Hi Whinii , I use the method you told me. But the program still runs more than 1 second. Could you tell me how I can accelerate it? Many thanks. #include<iostream> #include<stdlib.h> #include<cmath> using namespace std; long long alpri[80070]; unsigned int pri[80000]; inline bool isp(int m) { for(in...
by sharklu2000
Mon Aug 25, 2003 4:59 am
Forum: Volume 105 (10500-10599)
Topic: 10539 - Almost Prime Numbers
Replies: 44
Views: 24142

10539 - Almost Prime Numbers

I first calculate all the prime numbers between 1 and 10<sup>6</sup> then for every prime numbers below low and high, I add all the log below and high to the base of the prime number as a and b. Then b-a is the answer. But it is really inefficient, can anyone tell me some efficient algorithm. I will...
by sharklu2000
Fri Aug 22, 2003 3:57 am
Forum: Volume 104 (10400-10499)
Topic: 10480 - Sabotage
Replies: 8
Views: 5594

10480 - Sabotage

I want to use search but I think it's inefficient. Is there any efficient and
easy algorithm? Any hint is aprreciated.

Go to advanced search