z56's blog

By z56, history, 8 years ago, translation, In English
<?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://codeforces.net/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.

Full text and comments »

  • Vote: I like it
  • +12
  • Vote: I do not like it