結果

問題 No.278 連続する整数の和(2)
ユーザー kkkk
提出日時 2015-09-19 16:38:03
言語 PHP
(8.3.4)
結果
WA  
実行時間 -
コード長 497 bytes
コンパイル時間 1,054 ms
コンパイル使用メモリ 18,428 KB
実行使用メモリ 19,064 KB
最終ジャッジ日時 2023-09-26 13:41:20
合計ジャッジ時間 3,411 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
18,912 KB
testcase_01 WA -
testcase_02 AC 211 ms
18,700 KB
testcase_03 AC 15 ms
18,712 KB
testcase_04 AC 15 ms
18,816 KB
testcase_05 AC 16 ms
18,924 KB
testcase_06 AC 21 ms
18,884 KB
testcase_07 AC 15 ms
18,844 KB
testcase_08 WA -
testcase_09 AC 192 ms
18,732 KB
testcase_10 AC 250 ms
18,736 KB
testcase_11 AC 51 ms
18,860 KB
testcase_12 WA -
testcase_13 AC 45 ms
18,876 KB
testcase_14 AC 128 ms
18,936 KB
testcase_15 AC 41 ms
18,840 KB
testcase_16 AC 35 ms
18,828 KB
testcase_17 AC 203 ms
18,872 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php

function divisor_max($input){
	//-------------
	//約数最大値取得
	//-------------
	$max = 0;
	
	if (($input%2)==0){
        $max = $input / 2;
    }else{
        $max = $input;
    }
    
    return $max;
}

$input = trim(fgets(STDIN));

//約数最大値
$max = divisor_max($input);

$flg = 0;
$q  = 0;

$i  = 1;

while ($max > ($i * $i)){
	if ($max == ($i * $i)){
		$q += $i;
		$i++;
	}else if (($max%$i)==0){
		$q += ($max / $i) + $i;
		$i++;
	}else{
		$i++;
	}
}

echo $q . "\n";
0