## Search found 7 matches

Thu Nov 06, 2003 10:02 pm
Forum: Other words
Topic: Compiler / Interpreter ???
Replies: 11
Views: 3465
A workaround for the scope bug:
[cpp]
#define for if(0); else for
[/cpp]
Put this somewhere near the top of your source file, and 'for' will behave as it should.
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: 1708
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 ...
Thu May 22, 2003 5:29 pm
Forum: C++
Topic: A very very small problem
Replies: 12
Views: 3790
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 );
}[/cpp]
Fri Jan 24, 2003 4:27 pm
Forum: Volume 101 (10100-10199)
Topic: 10179 - Irreducible Basic Fractions
Replies: 28
Views: 9768

### 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...
Fri Nov 08, 2002 10:18 pm
Forum: Pascal
Topic: How fast is Pascal?
Replies: 7
Views: 9103

### 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++) { ...
Fri Aug 30, 2002 4:05 pm
Forum: Volume 100 (10000-10099)
Topic: 10098 - Generating Fast
Replies: 62
Views: 13937
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)
Sat May 04, 2002 7:29 pm
Forum: Volume 101 (10100-10199)
Topic: 10100 - Longest Match
Replies: 95
Views: 20889
I think in the first case the output should be 2.