結果

問題 No.1229 ラグビーの得点パターン
ユーザー xRS43BofaUEZ5gcxRS43BofaUEZ5gc
提出日時 2021-03-03 09:38:22
言語 Java21
(openjdk 21)
結果
AC  
実行時間 136 ms / 2,000 ms
コード長 727 bytes
コンパイル時間 3,472 ms
コンパイル使用メモリ 74,600 KB
実行使用メモリ 54,828 KB
最終ジャッジ日時 2024-04-14 05:51:49
合計ジャッジ時間 8,841 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
54,296 KB
testcase_01 AC 130 ms
54,160 KB
testcase_02 AC 132 ms
53,900 KB
testcase_03 AC 134 ms
54,320 KB
testcase_04 AC 134 ms
54,264 KB
testcase_05 AC 136 ms
54,288 KB
testcase_06 AC 132 ms
54,208 KB
testcase_07 AC 136 ms
54,376 KB
testcase_08 AC 133 ms
54,380 KB
testcase_09 AC 133 ms
54,012 KB
testcase_10 AC 133 ms
54,164 KB
testcase_11 AC 133 ms
54,236 KB
testcase_12 AC 133 ms
54,056 KB
testcase_13 AC 135 ms
54,040 KB
testcase_14 AC 133 ms
54,044 KB
testcase_15 AC 133 ms
54,124 KB
testcase_16 AC 133 ms
54,828 KB
testcase_17 AC 133 ms
53,968 KB
testcase_18 AC 136 ms
54,140 KB
testcase_19 AC 133 ms
54,084 KB
testcase_20 AC 136 ms
54,132 KB
testcase_21 AC 134 ms
54,080 KB
testcase_22 AC 133 ms
54,148 KB
testcase_23 AC 133 ms
54,188 KB
testcase_24 AC 134 ms
54,072 KB
testcase_25 AC 133 ms
53,832 KB
testcase_26 AC 134 ms
53,916 KB
testcase_27 AC 135 ms
54,468 KB
testcase_28 AC 135 ms
54,060 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class HelloWorld {

	    public static void main(String[] args) throws Exception {

	    	Scanner sc = new Scanner(System.in);
	    	int sum = sc.nextInt();
	    	int t = 5;
	    	int g = 2;
	    	int pg = 3;
	    	int count = 0;

	    	for (int number_pg = 0; number_pg <=sum / 3; number_pg ++) {
	    		for (int number_t = 0; number_t <= (sum - number_pg * 3) / 5; number_t ++) {
	    			for (int number_g = 0; number_g <= (sum - number_pg * 3 - number_t * 5) / 2&&
	    													number_g <= number_t; number_g ++) {
	    				if (number_t * 5 + number_g * 2 + number_pg * 3 == sum) {
	    					count ++;
	    				}
	    			}
	    		}
	    	}


	    	System.out.println(count);
	    	}

}
0