All pastes #816608 Raw Edit

Stuff

public text v1 · immutable
·published 2007-12-14 21:39 UTC
rendered paste body
<?
$n[0][]=0;
$n[1][]=1000;
$n[1][]=M;
$n[2][]=500;
$n[2][]=D;
$n[3][]=100;
$n[3][]=C;
$n[4][]=50;
$n[4][]=L;
$n[5][]=10;
$n[5][]=X;
$n[6][]=5;
$n[6][]=V;
$n[7][]=1;
$n[7][]=I;


/*Current*/
$x=0;
//print_r($n);
//die;
while($r=rtrim(fgets(STDIN))) {
echo $r ."\n";
	$t=0;
echo 'a';
	for($i=0;$i<strlen($r);$i++) {
echo 'b';
		for($b=0;$b<8;$b++) {
echo 'v';
			if($r{$i}==$n[$b][1]) {
				if($b < $x) {
					$t+=($n[$b][0]-$n[$x][0]);
				} else {
					$t+=$n[$x][0];
					$x=$b;
				}			
			}
		}
echo $t."\n";
	}
	//$t+=$n[$x][0];
}
echo $t."\n";