Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $in = file('shop.txt');
- $count = trim($in[0]) + 0;
- unset ($in[0]);
- $testset = array();
- $i = 0;
- $intestset = false;
- foreach ($in as $line ){
- $line = trim($line) + 0;
- if (!$intestset) {
- $intestset = true;
- $testsetmax = $line;
- if ($i > 0) ksort($testset[$i]);
- $i++;
- $testsetcount = 0;
- $testset[$i] = array();
- } else {
- $testsetcount++;
- if (!isset($testset[$i][$line])) $testset[$i][$line] = 0;
- $testset[$i][$line]++;
- if ($testsetcount == $testsetmax) {
- $intestset = false;
- }
- }
- }
- ksort($testset[$i]);
- foreach ($testset as $i => $tests) {
- $curmaxrange = 0;
- $curstart = -1;
- $testarr = $tests;
- $rangecount = array();
- foreach ($tests as $intime => $count) {
- foreach($rangecount as $rtime => $rcount) {
- if ($rtime + 59 < $intime) $rangecount[$rtime] += $count; // จะผิดก้ตรงเนี้ย ลองเทส 59 กับ 60 แล้ว แต่ยังไม่ได้เทส 58 -*-'
- }
- $rangecount[$intime] = $count;
- }
- // print_r($rangecount);
- echo max($rangecount)."\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment