Search found 7 matches

by abiczo
Thu Nov 06, 2003 10:02 pm
Forum: Other words
Topic: Compiler / Interpreter ???
Replies: 11
Views: 3781

A workaround for the scope bug:
#define for if(0); else for
Put this somewhere near the top of your source file, and 'for' will behave as it should.
by abiczo
Tue Jul 15, 2003 8:10 pm
Forum: ACM ICPC Archive Board
Topic: Test data for problem 2516 Sly Number may be incorrect!
Replies: 7
Views: 1906

As far as I can remember someone who competed in the regional contest where this problem was originally given said that the judge input might have been wrong. So if the judge data used here is the same as the one that was used in the contest then maybe the admins should take a look at it. Of course ...
by abiczo
Thu May 22, 2003 5:29 pm
Forum: C++
Topic: A very very small problem
Replies: 12
Views: 4090

As far as I know cin converts to false if EOF is reached. So you can use
[cpp]int k;
while( cin >> k ) {
process( k );
to read numbers until EOF.
by abiczo
Fri Jan 24, 2003 4:27 pm
Forum: Volume 101 (10100-10199)
Topic: 10179 - Irreducible Basic Fractions
Replies: 28
Views: 10538

Euler phi function

You should calculate Euler's phi function for the given input values. Since phi is multiplicative it's easy to calculate it: phi(n)=phi(p1^k1) * ... * phi(pl^kl) where n=p1^k1 * ... * pl^kl and p1, ..., pl are primes. phi(p^k) = p^k - p^(k-1) if p is prime. For example: 12 = 2^2 * 3, phi(12) = phi(2...
by abiczo
Fri Nov 08, 2002 10:18 pm
Forum: Pascal
Topic: How fast is Pascal?
Replies: 7
Views: 9515

Running times

I have both GCC (2.95.4) and Freepascal (1.0.6), so I tested what Ivan wrote. I tried the following programs: [pascal] program test; var i, x, y: longint; begin for i:=1 to 10000000 do begin x:=i; y:=x mod 10; x:=x mod 10; end; end. [/pascal] [c] int main() { int i, x, y; for(i=1;i<=10000000;i++) { ...
by abiczo
Fri Aug 30, 2002 4:05 pm
Forum: Volume 100 (10000-10099)
Topic: 10098 - Generating Fast
Replies: 62
Views: 15634

I think the problem is that there is no \0 at the end of 'permout'.
Before printing it, put a zero character at the end of 'permout' (e.g. permout[len]=0)
by abiczo
Sat May 04, 2002 7:29 pm
Forum: Volume 101 (10100-10199)
Topic: 10100 - Longest Match
Replies: 95
Views: 23104

I think in the first case the output should be 2.

Go to advanced search