If you look at people's solutions to problems, how come there are two diffferent types of fonts? This one and the one that looks ugly :P (All the submissions I'm talking about are my own, so they're all text)
If you look at people's solutions to problems, how come there are two diffferent types of fonts? This one and the one that looks ugly :P (All the submissions I'm talking about are my own, so they're all text)
Could someone tell me what the version of g++ the judge uses?
for my ccc01s4 Cookie problem, it works on the judge; and when I downloaded my source code and used Visual Studio to compile it, it works and gives the desired answer, but I used my g++ 3.4.2 (for windows) and the compiled program seemed to infinitely loop... so I upgraded it to 3.4.5, and this time it doesn't infinitely loop, but outputs 0.00 instead...
I'm not using obscure functions... all I included was iostream and cmath. I used operator overloading btw, but that shouldn't be an issue, should it?...
Could someone tell me what the version of g++ the judge uses?
for my ccc01s4 Cookie problem, it works on the judge; and when I downloaded my source code and used Visual Studio to compile it, it works and gives the desired answer, but I used my g++ 3.4.2 (for windows) and the compiled program seemed to infinitely loop... so I upgraded it to 3.4.5, and this time it doesn't infinitely loop, but outputs 0.00 instead...
I'm not using obscure functions... all I included was iostream and cmath. I used operator overloading btw, but that shouldn't be an issue, should it?...
They are all equally fast, but only if you use them in identical ways. While loops and repeat loops are essentially identical, the only difference being when the condition is checked (and checking that the condition is true will always take the same amount of time as checking that the condition is false). And a for loop is essentially a while/repeat loop in which the variable is incremented/decremented at every step; you would simply code this change directly if you used a while/repeat loop, instead of letting the compiler insert it.
Changing the choice of loop will not make any noticeable difference in execution time, and certainly not the difference between AC and TLE.
The following example shows when it can differ though:
With a for loop:
[code]
for i:=1 to 999999999 do
if i%12345679=0 then
writeln(i);
[/code]
With a while loop:
[code]
i:=12345679;
while i<=999999999 do
begin
writeln(i);
i:=i+12345679;
end;
[/code]
In this case, notice that the two loops do different things: the first loop executes 999999999 times, whereas the second one executes only 81 times.
They are all equally fast, but only if you use them in identical ways. While loops and repeat loops are essentially identical, the only difference being when the condition is checked (and checking that the condition is true will always take the same amount of time as checking that the condition is false). And a for loop is essentially a while/repeat loop in which the variable is incremented/decremented at every step; you would simply code this change directly if you used a while/repeat loop, instead of letting the compiler insert it.
Changing the choice of loop will not make any noticeable difference in execution time, and certainly not the difference between AC and TLE.
The following example shows when it can differ though: With a for loop:
for i:=1 to 999999999 do if i%12345679=0 then writeln(i);
With a while loop:
i:=12345679; while i<=999999999 do begin writeln(i); i:=i+12345679; end;
In this case, notice that the two loops do different things: the first loop executes 999999999 times, whereas the second one executes only 81 times.
It's a bit of a joke, I suppose, not strictly necessary. I thought of it after I pasted some copyrighted code into my solution for CCC Substrings, and remarked that solutions can be freely viewed by anyone who solves the problem. I can envisage a situation in which it might be important, though - just not in the near future.
It's a bit of a joke, I suppose, not strictly necessary. I thought of it after I pasted some copyrighted code into my solution for CCC Substrings, and remarked that solutions can be freely viewed by anyone who solves the problem. I can envisage a situation in which it might be important, though - just not in the near future.
Comments (Search)
for my ccc01s4 Cookie problem, it works on the judge; and when I downloaded my source code and used Visual Studio to compile it, it works and gives the desired answer, but I used my g++ 3.4.2 (for windows) and the compiled program seemed to infinitely loop... so I upgraded it to 3.4.5, and this time it doesn't infinitely loop, but outputs 0.00 instead...
I'm not using obscure functions... all I included was iostream and cmath. I used operator overloading btw, but that shouldn't be an issue, should it?...
Changing the choice of loop will not make any noticeable difference in execution time, and certainly not the difference between AC and TLE.
The following example shows when it can differ though:
With a for loop:
With a while loop:
In this case, notice that the two loops do different things: the first loop executes 999999999 times, whereas the second one executes only 81 times.
It seems out of place here on a practice judge.
Did someone get sued?
ACSL #2 (Feb 14, 2030 @ 12:02am)
Can anyone clarify?