結果

問題 No.1406 Test
ユーザー k k
提出日時 2023-10-23 16:58:10
言語 PHP
(843.2)
結果
AC  
実行時間 41 ms / 2,000 ms
コード長 507 bytes
コンパイル時間 1,704 ms
コンパイル使用メモリ 32,276 KB
実行使用メモリ 32,656 KB
最終ジャッジ日時 2024-09-22 11:02:41
合計ジャッジ時間 3,522 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
	$input = [];
    while ($line = fgets(STDIN)) {
        $input[] = explode(" ", trim($line)); //各行の値を変数xに代入、保管
    }
    
    $total = 0;
    if (isset($input[1])) {
        foreach ($input[1] as $n) {
	    	$total += $n;
    	}	
    }
    
    $count = 0;
    for ($i = 0; $i <= 100; $i++) {
    	$n = $total + $i;
    	
    	if ($input[0][0] > 1) {
    		if ($n % $input[0][0] == 0) {
    			$count++;		
    		}
    	} else {
    		$count++;
    	}

    }
    echo $count;
0