<?php $answer = 0; $pow10 = 10; $bunbo = array(0=>2); $bunshi = array(0=>3); for($i = 1 ; $i <= 1000 ; $i++) { $count = count($bunshi); for($d = 0 ; $d < $count ; $d++) { $bunshi[$d] = $bunshi[$d] + @$bunbo[$d] + @$bunbo[$d]; @$bunbo[$d] = $bunshi[$d] - @$bunbo[$d]; } for($d = 0 ; $d < $count ; $d++) { while($bunshi[$d] >= $pow10) { $bunshi[$d] -= $pow10; @$bunshi[$d + 1]++; } while($bunbo[$d] >= $pow10) { $bunbo[$d] -= $pow10; @$bunbo[$d + 1]++; } } if(count($bunshi) > count($bunbo)) { $answer++; } } echo $answer."\n"; ?>