Hello. I have trouble with PHP & files.

Revision en5, by z56, 2016-10-15 11:54:31
<?php
$in_f=fopen('cinemaholics.in', 'r');
$Max=trim(fgets($in_f)); $Mel=trim(fgets($in_f));
fclose($in_f);
$Max=explode(' ', $Max); $Mel=explode(' ', $Mel);
function persTime($pers){ return $pers[0]*3+$pers[1]*20+$pers[2]*120; }
$MaxTime=persTime($Max); $MelTime=persTime($Mel);
if($MaxTime>$MelTime) $out='Max';
elseif($MaxTime<$MelTime) $out='Mel';
else $out='Draw';
$out_f=fopen('cinemaholics.out', 'w');
fputs($out_f, $out.PHP_EOL);
fclose($out_f);

Doesn't works on http://mirror.codeforces.com/gym/101110/problem/A , but nice works in my local PHP CLI.

I read FAQ and it was something about PHP & files & that it 'll not work, but I'm not sure.

Tags php, file input

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en5 English z56 2016-10-15 11:54:31 5
ru6 Russian z56 2016-10-15 11:54:16 5
en4 English z56 2016-10-15 11:53:11 131
ru5 Russian z56 2016-10-15 11:52:53 131
en3 English z56 2016-10-14 14:09:12 86
ru4 Russian z56 2016-10-14 14:08:52 101
en2 English z56 2016-10-14 13:35:31 279 Opened all code
ru3 Russian z56 2016-10-14 13:34:01 279 Открыл весь код
ru2 Russian z56 2016-10-14 12:14:50 24 Мелкая правка: 'т на моём сервере.\nНадеюсь' -> 'т на моём локальном PHP CLI.\nНадеюсь'
en1 English z56 2016-10-14 12:14:02 631 Initial revision for English translation
ru1 Russian z56 2016-10-14 12:08:06 675 Первая редакция (опубликовано)