function calculatePoints($formula, $data)
{
    var_dump($formula);
    var_dump($data);
    $formula = str_replace('=', '', $formula);
    if (count($data) == 0) {
        $data['valor_informado'] = 0;
        $data['classif_informado'] = 0;
    }
    if (isset($data['valor_informado'])) {
        $formula = str_replace('valor_informado', $data['valor_informado'], $formula);
    }
    if (isset($data['classif_informado'])) {
        $formula = str_replace('classif_informado', $data['classif_informado'], $formula);
    }
    if (isset($data['decorrente_informado'])) {
        if (count($data['decorrente_informado']) == 1) {
            $formula = str_replace('decorrente_informado', $data['decorrente_informado'][0], $formula);
        } else {
            if (count($data['decorrente_informado']) == 2) {
                $formula = str_replace('decorrente_informado_1', $data['decorrente_informado'][0], $formula);
                $formula = str_replace('decorrente_informado_2', $data['decorrente_informado'][1], $formula);
            }
        }
    } else {
        $formula = str_replace('decorrente_informado_1', '0', $formula);
        $formula = str_replace('decorrente_informado_2', '0', $formula);
        $formula = str_replace('decorrente_informado', '0', $formula);
    }
    var_dump($formula);
    return solve($formula);
    return -1;
}
function main()
{
    global $argv, $argc, $TEST;
    // for testing purposes
    if ($argc == 2 and $argv[1] == "test") {
        $stream = fopen('php://memory', 'r+');
        fwrite($stream, $TEST);
        rewind($stream);
        solve($stream);
        return;
    }
    solve(STDIN);
}
Example #3
0
function solve($wire)
{
    global $wires;
    if (is_numeric($wire)) {
        return (int) $wire;
    } else {
        if (is_numeric($wires[$wire])) {
            return (int) $wires[$wire];
        } else {
            switch ($wires[$wire]['op']) {
                case 'SET':
                    $value = solve($wires[$wire]['ref']);
                    break;
                case 'NOT':
                    $value = ~solve($wires[$wire]['ref']) & 65535;
                    break;
                case 'AND':
                    $value = solve($wires[$wire]['ref'][0]) & solve($wires[$wire]['ref'][1]);
                    break;
                case 'OR':
                    $value = solve($wires[$wire]['ref'][0]) | solve($wires[$wire]['ref'][1]);
                    break;
                case 'XOR':
                    $value = solve($wires[$wire]['ref'][0]) ^ solve($wires[$wire]['ref'][1]);
                    break;
                case 'RSHIFT':
                    $value = solve($wires[$wire]['ref'][0]) >> solve($wires[$wire]['ref'][1]);
                    break;
                case 'LSHIFT':
                    $value = solve($wires[$wire]['ref'][0]) << solve($wires[$wire]['ref'][1]);
                    break;
            }
            $wires[$wire] = $value;
            return $value;
        }
    }
}
Example #4
0
<?php

function solve($string)
{
    list($letters, $numbers) = explode("|", $string);
    foreach (explode(" ", $numbers) as $number) {
        echo $letters[$number - 1];
    }
    echo "\n";
}
foreach (file($argv[1]) as $line) {
    if (trim($line) != "") {
        solve(trim($line));
    }
}
Example #5
0
                    case 'OR':
                        $solved[$var] = $values[0] | $values[1];
                        break;
                    case 'NOT':
                        $solved[$var] = ~$values[0];
                        break;
                    case '->':
                        $solved[$var] = $values[0];
                        break;
                }
                // substitute obtained value
                foreach ($eqs as $var2 => $eq2) {
                    if (isset($solved[$var2])) {
                        continue;
                    }
                    for ($j = 0; $j < count($eqs[$var2]['values']); $j++) {
                        if ($eqs[$var2]['values'][$j] === $var) {
                            $eqs[$var2]['values'][$j] = $solved[$var];
                        }
                    }
                }
            }
        }
    }
    return $solved;
}
$vars = solve($eqs);
printf('ans#7.1: %u' . PHP_EOL, $vars['a']);
$eqs['b']['values'] = [$vars['a']];
$vars = solve($eqs);
printf('ans#7.2: %u' . PHP_EOL, $vars['a']);
<?php

include "./config.php";
login_chk();
dbconnect();
if (preg_match('/prob|_|\\.|\\(\\)/i', $_GET[no])) {
    exit("No Hack ~_~");
}
if (preg_match('/\'/i', $_GET[pw])) {
    exit("HeHe");
}
if (preg_match('/\'|substr|ascii|=|or|and| |like|0x/i', $_GET[no])) {
    exit("HeHe");
}
$query = "select id from prob_bugbear where id='guest' and pw='{$_GET[pw]}' and no={$_GET[no]}";
echo "<hr>query : <strong>{$query}</strong><hr><br>";
$result = @mysql_fetch_array(mysql_query($query));
if ($result['id']) {
    echo "<h2>Hello {$result[id]}</h2>";
}
$_GET[pw] = addslashes($_GET[pw]);
$query = "select pw from prob_bugbear where id='admin' and pw='{$_GET[pw]}'";
$result = @mysql_fetch_array(mysql_query($query));
if ($result['pw'] && $result['pw'] == $_GET['pw']) {
    solve("bugbear");
}
highlight_file(__FILE__);
<?php

include "./config.php";
login_chk();
dbconnect();
if (preg_match('/\'/i', $_GET[pw])) {
    exit("No Hack ~_~");
}
$query = "select id from prob_assassin where pw like '{$_GET[pw]}'";
echo "<hr>query : <strong>{$query}</strong><hr><br>";
$result = @mysql_fetch_array(mysql_query($query));
if ($result['id']) {
    echo "<h2>Hello {$result[id]}</h2>";
}
if ($result['id'] == 'admin') {
    solve("assassin");
}
highlight_file(__FILE__);
function solve($aPoss, $nTotal, $aNo)
{
    $aRes = [];
    //Last Cell
    if (count($aPoss) == 1) {
        if ($nTotal < 10 && !in_array($nTotal, $aNo)) {
            $p = array_search($nTotal, $aPoss[0]);
            if ($p !== false) {
                $aRes[] = str_repeat(' ', $p) . $nTotal . str_repeat(' ', count($aPoss[0]) - $p);
            }
        }
        return $aRes;
    }
    $aPossB = $aPoss;
    $aMyPoss = array_shift($aPossB);
    $nMyCnt = count($aMyPoss);
    foreach ($aMyPoss as $i => $n) {
        if ($n >= $nTotal || in_array($n, $aNo)) {
            continue;
        }
        $aMyNo = $aNo;
        $aMyNo[] = $n;
        $str = str_repeat(' ', $i) . $n . str_repeat(' ', $nMyCnt - $i);
        $aNewPoss = solve($aPossB, $nTotal - $n, $aMyNo);
        foreach ($aNewPoss as $cP) {
            $aRes[] = $str . $cP;
        }
    }
    return $aRes;
}
Example #9
0
File: b.php Project: blerou/gcj
<?php

$inputFile = $_SERVER['argv'][1];
$outputFile = $inputFile . '.out';
$fin = fopen($inputFile, 'r');
$fout = fopen($outputFile, 'w+');
$cases = fgets($fin);
$case = 0;
while (!feof($fin)) {
    $case++;
    $in = fgets($fin);
    if ($case > $cases) {
        break;
    }
    list($combs, $opps, $inv) = parse($in);
    $out = solve($combs, $opps, $inv);
    $res = sprintf("Case #%d: %s\n", $case, format($out));
    fputs($fout, $res);
    echo "{$res}";
}
function parse($in)
{
    $in = explode(' ', $in);
    $numComb = (int) $in[0];
    $combs = array_slice($in, 1, $numComb);
    $in = array_slice($in, $numComb + 1);
    $numOpp = (int) $in[0];
    $opps = array_slice($in, 1, $numOpp);
    $in = array_slice($in, $numOpp + 1);
    $numInv = (int) $in[0];
    $inv = array();
Example #10
0
function next_step($new_position, $val, $status)
{
    $answer = array();
    if ($status[$new_position] == 1) {
        // new_positionはすでに踏んでるので調査終了
        //$answer[][0] = 999;
    } else {
        $status[$new_position] = 1;
        if (!in_array(0, $status)) {
            // new_positionでゴール
            $answer[][0] = $new_position;
        }
        // new_positionではゴールも終了もしないで調査続行
        $answer = array_merge($answer, solve($new_position, $val, $status));
    }
    return $answer;
}
<?php

include "./config.php";
login_chk();
dbconnect();
if (strlen($_GET[shit]) > 1) {
    exit("No Hack ~_~");
}
if (preg_match('/ |\\n|\\r|\\t/i', $_GET[shit])) {
    exit("HeHe");
}
$query = "select 1234 from{$_GET[shit]}prob_giant where 1";
echo "<hr>query : <strong>{$query}</strong><hr><br>";
$result = @mysql_fetch_array(mysql_query($query));
if ($result[1234]) {
    solve("giant");
}
highlight_file(__FILE__);
<?php

include "./config.php";
login_chk();
dbconnect();
if (preg_match('/_|\\.|\\(\\)/i', $_GET[limit])) {
    exit("No Hack ~_~");
}
if (preg_match('/union|where|hellfire/i', $_GET[limit])) {
    exit("hehe");
}
if ($_GET[limit]) {
    $limit = $_GET[limit];
} else {
    $limit = 1;
}
$query = "select id from probevilwizard where id='admin' limit {$limit}";
$result = @mysql_fetch_array(mysql_query($query));
if (mysql_error()) {
    exit;
}
echo "<hr>query : <strong>{$query}</strong><hr><br>";
$_GET[pw] = addslashes($_GET[pw]);
$query = "select pw from probevilwizard where id='admin' and pw='{$_GET[pw]}'";
$result = @mysql_fetch_array(mysql_query($query));
if ($result['pw'] && $result['pw'] == $_GET['pw']) {
    solve("evil_wizard");
}
highlight_file(__FILE__);
<?php

include "./config.php";
login_chk();
dbconnect();
if (preg_match('/_|\\.|\\(\\)/i', $_GET[limit])) {
    exit("No Hack ~_~");
}
if (preg_match('/union|where|evilwizard/i', $_GET[limit])) {
    exit("hehe");
}
if ($_GET[limit]) {
    $limit = $_GET[limit];
} else {
    $limit = 1;
}
$query = "select id from probhellfire where id='admin' limit {$limit}";
$result = @mysql_fetch_array(mysql_query($query));
if (mysql_error()) {
    exit(mysql_error());
}
echo "<hr>query : <strong>{$query}</strong><hr><br>";
$_GET[pw] = addslashes($_GET[pw]);
$query = "select pw from probhellfire where id='admin' and pw='{$_GET[pw]}'";
$result = @mysql_fetch_array(mysql_query($query));
if ($result['pw'] && $result['pw'] == $_GET['pw']) {
    solve("hell_fire");
}
highlight_file(__FILE__);
<?php

include "./config.php";
login_chk();
dbconnect();
if (preg_match('/prob|_|\\.|\\(\\)/i', $_GET[no])) {
    exit("No Hack ~_~");
}
if (preg_match('/\'|\\"|\\`/i', $_GET[no])) {
    exit("No Quotes ~_~");
}
$query = "select id from prob_goblin where id='guest' and no={$_GET[no]}";
echo "<hr>query : <strong>{$query}</strong><hr><br>";
$result = @mysql_fetch_array(mysql_query($query));
if ($result['id']) {
    echo "<h2>Hello {$result[id]}</h2>";
}
if ($result['id'] == 'admin') {
    solve("goblin");
}
highlight_file(__FILE__);
<?php

include "./config.php";
login_chk();
dbconnect();
if (preg_match('/prob|_|\\.|\\(\\)/i', $_GET[id])) {
    exit("No Hack ~_~");
}
// do not try to attack another table, database!
if (preg_match('/prob|_|\\.|\\(\\)/i', $_GET[pw])) {
    exit("No Hack ~_~");
}
$query = "select id from prob_gremlin where id='{$_GET[id]}' and pw='{$_GET[pw]}'";
echo "<hr>query : <strong>{$query}</strong><hr><br>";
$result = @mysql_fetch_array(mysql_query($query));
if ($result['id']) {
    solve("gremlin");
}
highlight_file(__FILE__);
Example #16
0
    return array_sum(array_map($work, $vs));
}
function solve()
{
    fscanf(STDIN, '%d%d', $b, $n);
    $ms = array_map('intval', explode(' ', fgets(STDIN)));
    $x = 0;
    $y = 100000000000001;
    while ($x < $y) {
        $z = (int) (($x + $y) / 2);
        if (simulate($ms, $z) < $n) {
            $x = $z + 1;
        } else {
            $y = $z;
        }
    }
    $n_ = $x ? simulate($ms, $x - 1) : 0;
    foreach ($ms as $i => $m) {
        if ($x % $m == 0) {
            $n_ += 1;
            if ($n_ == $n) {
                return $i + 1;
            }
        }
    }
    return -1;
}
fscanf(STDIN, '%d', $cases);
for ($num = 1; $num <= $cases; $num++) {
    printf("Case #%d: %d\n", $num, solve());
}
<?php

include "./config.php";
login_chk();
dbconnect();
if (preg_match('/prob|_|\\.|\\(\\)/i', $_GET[pw])) {
    exit("No Hack ~_~");
}
if (preg_match('/ /i', $_GET[pw])) {
    exit("No whitespace ~_~");
}
$query = "select id from prob_wolfman where id='guest' and pw='{$_GET[pw]}'";
echo "<hr>query : <strong>{$query}</strong><hr><br>";
$result = @mysql_fetch_array(mysql_query($query));
if ($result['id']) {
    echo "<h2>Hello {$result[id]}</h2>";
}
if ($result['id'] == 'admin') {
    solve("wolfman");
}
highlight_file(__FILE__);
<?php

include "./config.php";
login_chk();
dbconnect();
if (preg_match('/prob|_|\\.|\\(\\)/i', $_GET[pw])) {
    exit("No Hack ~_~");
}
if (preg_match('/or|and/i', $_GET[pw])) {
    exit("HeHe");
}
$query = "select id from prob_orge where id='guest' and pw='{$_GET[pw]}'";
echo "<hr>query : <strong>{$query}</strong><hr><br>";
$result = @mysql_fetch_array(mysql_query($query));
if ($result['id']) {
    echo "<h2>Hello {$result[id]}</h2>";
}
$_GET[pw] = addslashes($_GET[pw]);
$query = "select pw from prob_orge where id='admin' and pw='{$_GET[pw]}'";
$result = @mysql_fetch_array(mysql_query($query));
if ($result['pw'] && $result['pw'] == $_GET['pw']) {
    solve("orge");
}
highlight_file(__FILE__);
<?php

include "./config.php";
login_chk();
dbconnect();
if (preg_match('/\'/i', $_GET[id])) {
    exit("No Hack ~_~");
}
$_GET[id] = str_replace("admin", "", $_GET[id]);
$query = "select id from prob_vampire where id='{$_GET[id]}'";
echo "<hr>query : <strong>{$query}</strong><hr><br>";
$result = @mysql_fetch_array(mysql_query($query));
if ($result['id'] == 'admin') {
    solve("vampire");
}
highlight_file(__FILE__);
<?php

function reverseOf($number)
{
    $result = 0;
    while ($number > 0) {
        $lastDigit = $number % 10;
        $result = 10 * $result + $lastDigit;
        $number = ($number - $lastDigit) / 10;
    }
    return $result;
}
function solve($number)
{
    $it = 0;
    $reverse = reverseOf($number);
    while ($number != $reverse) {
        $number += $reverse;
        $reverse = reverseOf($number);
        $it++;
    }
    return "{$it} {$number}";
}
foreach (file($argv[1]) as $line) {
    $number = trim($line);
    echo solve($number) . "\n";
}
Example #21
0
<?php

function getStringCount($string)
{
    $string = trim($string);
    $codeCount = strlen($string);
    $string = str_replace('\\\\', '1', $string);
    $string = preg_replace('/\\\\x[a-z0-9][a-z0-9]/', "1", $string);
    $string = str_replace('\\"', '1', $string);
    $strlen = strlen($string) - 2;
    return array('cC' => $codeCount, 'sC' => $strlen);
}
function solve($fileName)
{
    $handle = fopen($fileName, "r");
    if ($handle) {
        $totalC = 0;
        $totalS = 0;
        while (($line = fgets($handle)) !== false) {
            $arr = getStringCount($line);
            $totalC += $arr['cC'];
            $totalS += $arr['sC'];
        }
        fclose($handle);
        echo $totalC - $totalS;
    }
}
solve('input.txt');
        mysql_query("insert into prob_umaru values('{$_SESSION[los_id]}','{$new_flag}')");
    } else {
        mysql_query("update prob_umaru set flag='{$new_flag}' where id='{$_SESSION[los_id]}'");
    }
    echo "reset ok";
    highlight_file(__FILE__);
    exit;
}
if (!$_GET[flag]) {
    highlight_file(__FILE__);
    exit;
}
if (preg_match('/prob|_|\\./i', $_GET[flag])) {
    exit("No Hack ~_~");
}
if (preg_match('/id|where|order|limit|,/i', $_GET[flag])) {
    exit("HeHe");
}
if (strlen($_GET[flag]) > 100) {
    exit("HeHe");
}
$realflag = @mysql_fetch_array(mysql_query("select flag from prob_umaru where id='{$_SESSION[los_id]}'"));
@mysql_query("create temporary table prob_umaru_temp as select * from prob_rubiya where id='{$_SESSION[los_id]}'");
@mysql_query("update prob_umaru_temp set flag={$_GET[flag]}");
$tempflag = @mysql_fetch_array(mysql_query("select flag from prob_umaru_temp"));
if (!$realflag[flag] || $realflag[flag] != $tempflag[flag]) {
    reset_flag();
}
if ($realflag[flag] === $_GET[flag]) {
    solve("umaru");
}
Example #23
0
    $start = microtime();
    $saved = array();
    $saved_sud = array();
    while (!is_solved_sudoku($sudoku)) {
        $x += 1;
        $next_move = scan_sudoku_for_unique($sudoku);
        if ($next_move == false) {
            $next_move = array_pop($saved);
            $sudoku = array_pop($saved_sud);
        }
        $what_to_try = next_random($next_move);
        $attempt = determine_random_possible_value($next_move, $what_to_try);
        if (count($next_move[$what_to_try]) > 1) {
            $next_move[$what_to_try] = remove_attempt($next_move[$what_to_try], $attempt);
            array_push($saved, $next_move);
            array_push($saved_sud, $sudoku);
        }
        $sudoku[$what_to_try] = $attempt;
    }
    $end = microtime();
    $ms_start = explode(" ", $start);
    $ms_end = explode(" ", $end);
    $total_time = round($ms_end[1] - $ms_start[1] + $ms_end[0] - $ms_start[0], 2);
    echo "completed in {$x} steps in {$total_time} seconds";
    echo print_sudoku($sudoku);
    echo "<br/>";
    echo "          Server 1";
}
$sudoku = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
solve($sudoku);
Example #24
0
function begin($startX, $startY)
{
    if ($startY > 0 && $startY == $startX) {
        begin($startY - 1, $startY - 1, $board);
    }
    if ($startX > 0) {
        begin($startX - 1, $startY, $board);
    }
    $board = newBoard();
    $board[$startY][$startX] = 1;
    //the first move location will be "1"
    echo "Starting at: (" . $startY . "," . $startX . ")\n";
    $solution = solve($board, $startY, $startX, 2);
}
                            $bestMatch = $theMatch;
                            $bestMatchLength = $match_length;
                        }
                    }
                }
                $matching = false;
                $match_length = 0;
            }
        }
        if ($matching) {
            $match_length = min(array($match_length, $offset));
            if ($match_length > $bestMatchLength) {
                $theMatch = "";
                for ($j = $match_start; $j < $match_start + $match_length; $j++) {
                    $theMatch .= $theString[$j];
                }
                if (trim($theMatch) != "") {
                    $bestMatch = $theMatch;
                    $bestMatchLength = $match_length;
                }
            }
        }
    }
    if ($bestMatchLength == 0) {
        return "NONE";
    }
    return $bestMatch;
}
foreach (file($argv[1]) as $line) {
    echo solve(trim($line)) . "\n";
}
<?php

include "./config.php";
login_chk();
dbconnect();
if (preg_match('/\\\\|prob|_|\\.|\\(\\)/i', $_GET[id])) {
    exit("No Hack ~_~");
}
if (preg_match('/\\\\|prob|_|\\.|\\(\\)/i', $_GET[pw])) {
    exit("No Hack ~_~");
}
if (@ereg("'", $_GET[id])) {
    exit("HeHe");
}
if (@ereg("'", $_GET[pw])) {
    exit("HeHe");
}
$query = "select id from prob_zombie_assassin where id='{$_GET[id]}' and pw='{$_GET[pw]}'";
echo "<hr>query : <strong>{$query}</strong><hr><br>";
$result = @mysql_fetch_array(mysql_query($query));
if ($result['id']) {
    solve("zombie_assassin");
}
highlight_file(__FILE__);
}
function findEmptyPoint($board)
{
    for ($i = 0; $i < 9; $i++) {
        for ($j = 0; $j < 9; $j++) {
            if ($board[$i][$j] == 0) {
                return [$i, $j];
            }
        }
    }
}
function solve($board)
{
    // get empty spaces, find one with one choice, set it , rinse and repeat
    while (!filled($board) && !validSolution($board)) {
        for ($i = 0; $i < 9; $i++) {
            for ($j = 0; $j < 9; $j++) {
                if ($board[$i][$j] == 0) {
                    $valid = validValuesFor($board, [$i, $j]);
                    if (count($valid) == 1) {
                        $board[$i][$j] = $valid[0];
                    }
                }
            }
        }
    }
    return $board;
}
$solved = solve([[0, 5, 6, 9, 0, 7, 4, 0, 0], [0, 8, 1, 0, 4, 0, 0, 0, 0], [0, 0, 0, 0, 1, 5, 0, 9, 0], [0, 0, 0, 0, 0, 3, 8, 5, 7], [8, 4, 0, 0, 6, 0, 0, 2, 3], [7, 3, 9, 2, 0, 0, 0, 0, 0], [0, 6, 0, 5, 8, 0, 0, 0, 0], [0, 0, 0, 0, 7, 0, 3, 6, 0], [0, 0, 8, 3, 0, 6, 5, 7, 0]]);
echo validSolution($solved);
print_r($solved);
Example #28
0
<?php

/****************
4x + 7y + 2z = 34 
3x + 1y + 5z = 21 
8x + 2y + 6z = 52 
 ****************/
$matrix[0] = array(4, 7, 2);
$matrix[1] = array(3, 1, 5);
$matrix[2] = array(8, 2, 6);
$b[0] = 34;
$b[1] = 21;
$b[2] = 52;
// Решаем уравнение
list($x, $y, $z) = solve($matrix, $b);
echo "Решение<br />";
echo "X = {$x}<br />";
echo "Y = {$y}<br />";
echo "Z = {$z}<br />";
// Проверка
echo 4 * $x + 7 * $y + 2 * $z;
echo "<br>";
echo 3 * $x + 1 * $y + 5 * $z;
echo "<br>";
echo 8 * $x + 2 * $y + 6 * $z;
function solve($matrix, $b)
{
    // Вычисляем детерминант исходной матрицы
    $determinant = determinant($matrix);
    // Формируем детерминант для переменных
    for ($i = 0; $i < 3; $i++) {
<?php

include "./config.php";
login_chk();
dbconnect();
if (preg_match('/prob|_|\\.|\\(\\)/i', $_GET[pw])) {
    exit("No Hack ~_~");
}
if (preg_match('/or|and|substr\\(|=/i', $_GET[pw])) {
    exit("HeHe");
}
$query = "select id from prob_golem where id='guest' and pw='{$_GET[pw]}'";
echo "<hr>query : <strong>{$query}</strong><hr><br>";
$result = @mysql_fetch_array(mysql_query($query));
if ($result['id']) {
    echo "<h2>Hello {$result[id]}</h2>";
}
$_GET[pw] = addslashes($_GET[pw]);
$query = "select pw from prob_golem where id='admin' and pw='{$_GET[pw]}'";
$result = @mysql_fetch_array(mysql_query($query));
if ($result['pw'] && $result['pw'] == $_GET['pw']) {
    solve("golem");
}
highlight_file(__FILE__);
<?php

include "./config.php";
login_chk();
dbconnect();
if (preg_match('/prob|_|\\.|\\(\\)/i', $_GET[pw])) {
    exit("No Hack ~_~");
}
$query = "select id from prob_dragon where id='guest'# and pw='{$_GET[pw]}'";
echo "<hr>query : <strong>{$query}</strong><hr><br>";
$result = @mysql_fetch_array(mysql_query($query));
if ($result['id']) {
    echo "<h2>Hello {$result[id]}</h2>";
}
if ($result['id'] == 'admin') {
    solve("dragon");
}
highlight_file(__FILE__);