Hello. I have trouble with PHP & files.

Revision en2, by z56, 2016-10-14 13:35:31

<?php
$in_f=fopen(__DIR__.DIRECTORY_SEPARATOR.'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(__DIR__.DIRECTORY_SEPARATOR.'cinemaholics.out', 'r+');
fputs($out_f, $out.PHP_EOL);
fclose($out_f);

Doesn't works on http://codeforces.net/gym/101110/problem/A , but nice works in my local PHP CLI. I hope someone is reading it, I am noob, I don't know if someone is reading. Thanks.

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 Первая редакция (опубликовано)