function contest_get_problem_point_from_mixed($cid, $cpid, $t) { if ($t < 0) { $t = 0; } if (!contest_exist($cid)) { return null; } $row = contest_get_problem_from_mixed($cid, $cpid); if ($row['type'] == 1) { $pt = $row['base'] - intval($t) / 60 * $row['para_a']; if ($pt < $row['minp']) { $pt = $row['minp']; } } else { if ($row['type'] == 2) { //$t=intval(intval($t)/60); $t = intval($t); $pt = $row['base'] * (doubleval($row['para_a']) + doubleval($row['para_b']) * doubleval($row['para_c']) * doubleval($row['para_c']) / (doubleval($row['para_d']) * $t * $t + doubleval($row['para_c']) * doubleval($row['para_c']))); if ($pt < $row['minp']) { $pt = $row['minp']; } } } return round($pt, 2); }
<?php include_once 'functions/users.php'; include_once 'functions/sidebars.php'; include_once 'functions/contests.php'; include_once 'functions/problems.php'; $cpid = convert_str($_GET['cpid']); $cid = convert_str($_GET['cid']); $prob_info = contest_get_problem_from_mixed($cid, $cpid); $lastlang = $_COOKIE[$config["cookie_prefix"] . "lastlang"]; if ($lastlang == null) { $lastlang = 1; } if (!contest_started($cid) || !($current_user->is_root() || contest_get_val($cid, "isprivate") == 0 || contest_get_val($cid, "isprivate") == 1 && $current_user->is_in_contest($cid) || contest_get_val($cid, "isprivate") == 2 && contest_get_val($cid, "password") == $_COOKIE[$config["cookie_prefix"] . "contest_pass_{$cid}"])) { ?> <div class="span12"> <p class="alert alert-error">Problem Unavailable! Or it's a private contest!</p> </div> <?php } else { ?> <div class="span9"> <?php $show_problem = new Problem(); $pid = $prob_info["pid"]; $label = $prob_info["lable"]; $show_problem->set_problem($pid); if (!$show_problem->is_valid()) { ?> <p class="alert alert-error">Problem Unavailable!</p>