Search found 5 matches

by Alexandru Mosoi
Thu Sep 26, 2002 4:43 pm
Forum: Volume 103 (10300-10399)
Topic: 10364 - Square
Replies: 47
Views: 22071

????

How did you do the backtracking?? I got only 3sec and something using back. What optimisation did you do??
by Alexandru Mosoi
Tue Sep 24, 2002 8:35 am
Forum: Volume 103 (10300-10399)
Topic: 10311 - Goldbach and Euler
Replies: 98
Views: 33737

Sorry, I considered that 1 is prime. But still WA... Why?

Sorry, I considered that 1 is prime. But still WA... Why?
by Alexandru Mosoi
Tue Sep 24, 2002 7:54 am
Forum: Volume 103 (10300-10399)
Topic: 10311 - Goldbach and Euler
Replies: 98
Views: 33737

10311 - Why do I get WA??

I'm using Fermat's little theorem to check the primality of a given number.
In order not to have problems with pseudoprime numbers, I also made a list with them (I took it from the Internet). So, every time I found a number that can be prime I check the list. If the list contains that number then ...
by Alexandru Mosoi
Tue Mar 05, 2002 3:18 pm
Forum: Volume 102 (10200-10299)
Topic: 10235 - Simply Emirp
Replies: 150
Views: 51178

10235

while(scanf("%d", &x) == 1)
{
if(!prime(x)) printf("%d is not prime.n", x);
else
if(!prime(reverse(x)) || x == reverse(x)) printf("%d is prime.n", x);
else printf("%d is emirp.n", x);
}

This is my (main) source code.
Why do I get P.E.?

prime(x) - tests if x is prime
reverse(x) - returns x ...
by Alexandru Mosoi
Wed Feb 20, 2002 1:47 pm
Forum: Volume 1 (100-199)
Topic: 191 - Intersection
Replies: 103
Views: 33521

This is my source...

#include <stdio.h>

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

// intersection with a verical line

int vli(long long xs, long long ys, long long xe, long long ye, long long x, long long y1, long long y2)
{
if(min(xs, xe) > x || max(xs ...

Go to advanced search