Search found 108 matches

by Maarten
Mon Oct 13, 2003 5:35 pm
Forum: Volume 101 (10100-10199)
Topic: 10168 - Summation of Four Primes
Replies: 51
Views: 20049

Dominik, can you describe in detail how your algorithm works? I still don't understand your method... If you want to find two primes k and l such that k + l = N, then at least one of them has to be bigger than (or equal to) N, right? So if I know primes up to sqrt(N) only, what does it help me? Of c...
by Maarten
Mon Oct 13, 2003 5:28 pm
Forum: Other words
Topic: Why do people use topic number (only) as subject?
Replies: 3
Views: 882

I totally agree with you, it is a lot of work to find out what problem the question is about. Also, I think that people should not just post their code without a thorough explanation of what you are doing. I am willing to help anyone who has problems, but please agree to those rules. Also, some peop...
by Maarten
Sat Oct 11, 2003 7:41 pm
Forum: Volume 4 (400-499)
Topic: 453 - Intersecting Circles
Replies: 84
Views: 14846

two rules:

(1) please print formatted code
(2) please tell us what is the problem about
by Maarten
Sat Oct 11, 2003 7:39 pm
Forum: Volume 102 (10200-10299)
Topic: 10298 - Power Strings
Replies: 31
Views: 13311

nothing wrong with the problem; obviously the judge input doesn't include the test case you described.
by Maarten
Sat Oct 11, 2003 9:23 am
Forum: Volume 101 (10100-10199)
Topic: 10168 - Summation of Four Primes
Replies: 51
Views: 20049

you found a linear (O(n)) time for checking if a number is prime??? I would VERY much like to know it, and i think *all* mathematicians and computer scientists would be interested as well!
by Maarten
Thu Oct 09, 2003 5:21 pm
Forum: Volume 101 (10100-10199)
Topic: 10168 - Summation of Four Primes
Replies: 51
Views: 20049

I still don't understand. I assume your code would look something like this then (pseudocode): if( n%2 == 0 ) write "2 2"; n = n-4; if( n%2 == 1 ) write "2 3"; n = n-5; // now n is even so it can be written as the sum of two primes for( int i=2; i<n; i++ ) if( prime[i] && prime[n-i] ) write i, n+i; ...
by Maarten
Thu Oct 09, 2003 10:54 am
Forum: Volume 101 (10100-10199)
Topic: 10168 - Summation of Four Primes
Replies: 51
Views: 20049

hmm... i don't understand it yet. Suppose I have to write the number N=10000000 as the sum of 4 primes. Then at least one of those primes should be bigger than N/4 = 2,500,000, which is a lot bigger than sqrt(N) = 3000...
So how can it be sufficient to compute only primes up to sqrt(N) ?
by Maarten
Thu Oct 09, 2003 12:18 am
Forum: Volume 1 (100-199)
Topic: 102 - Ecological Bin Packing
Replies: 485
Views: 36071

it means there are only lines with 9 integers on them
by Maarten
Wed Oct 08, 2003 9:25 pm
Forum: Volume 101 (10100-10199)
Topic: 10168 - Summation of Four Primes
Replies: 51
Views: 20049

this problem is very easy if you know the following almost-theorem (the Goldbach Conjecture): Every even number >= 4 can be written as the sum of two primes My program ran in 1.5 seconds however; so it's pretty slow.. At the moment I'm precalculating primes up to 10000000 using the famous siff, and ...
by Maarten
Wed Oct 08, 2003 8:38 pm
Forum: Volume 1 (100-199)
Topic: 133 - The Dole Queue
Replies: 42
Views: 5651

by Maarten
Wed Oct 08, 2003 8:36 pm
Forum: Volume 1 (100-199)
Topic: 102 - Ecological Bin Packing
Replies: 485
Views: 36071

read the problem description:
The input consists of a series of lines with each line containing 9 integers.
by Maarten
Wed Oct 08, 2003 2:14 pm
Forum: Volume 104 (10400-10499)
Topic: 10427 - Naughty Sleepy Boys
Replies: 35
Views: 21101

please post in volum CIV
by Maarten
Wed Oct 08, 2003 11:14 am
Forum: Volume 1 (100-199)
Topic: 133 - The Dole Queue
Replies: 42
Views: 5651

just replace

[cpp]
fgets(line,10000,stdin);
line[strlen(line)-1]=0;
sscanf(line,"%d %d %d",&n,&k,&m);
[/cpp]

by

[cpp]
scanf( "%d %d %d\n", &n, &k, &m );
[/cpp]
by Maarten
Wed Oct 08, 2003 11:12 am
Forum: Volume 1 (100-199)
Topic: 113 - Power of Cryptography
Replies: 162
Views: 15777

why would you?
the formula exp( log(p)/n ) correctly calculates the nth root of p
by Maarten
Tue Oct 07, 2003 11:25 pm
Forum: Algorithms
Topic: One interesting geometry problem...... Help me to solve it
Replies: 13
Views: 3246

what you mean by "segments" ?

Go to advanced search