結果

問題 No.398 ハーフパイプ(2)
ユーザー FF256grhyFF256grhy
提出日時 2016-07-16 00:12:31
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 8 ms / 2,000 ms
コード長 753 bytes
コンパイル時間 835 ms
コンパイル使用メモリ 27,044 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-09 22:05:42
合計ジャッジ時間 1,192 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
4,376 KB
testcase_01 AC 7 ms
4,380 KB
testcase_02 AC 7 ms
4,376 KB
testcase_03 AC 8 ms
4,380 KB
testcase_04 AC 7 ms
4,380 KB
testcase_05 AC 7 ms
4,376 KB
testcase_06 AC 7 ms
4,376 KB
testcase_07 AC 7 ms
4,376 KB
testcase_08 AC 7 ms
4,376 KB
testcase_09 AC 7 ms
4,376 KB
testcase_10 AC 7 ms
4,380 KB
testcase_11 AC 6 ms
4,376 KB
testcase_12 AC 7 ms
4,376 KB
testcase_13 AC 7 ms
4,376 KB
testcase_14 AC 7 ms
4,380 KB
testcase_15 AC 7 ms
4,376 KB
testcase_16 AC 7 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

int table[8][4] = {
	{ 1,  2,  2,  4}, // 000
	{ 2,  4,  6, 12}, // 001
	{ 2,  4,  4,  8}, // 010
	{ 6, 12, 24, 48}, // 011
	{ 2,  6,  4, 12}, // 100
	{ 4, 12, 12, 36}, // 101
	{ 6, 24, 12, 48}, // 110
	{24,120,120,720}  // 111
};

int main() {
	double x;
	scanf("%lf", &x);
	int n = x * 4;
	
	long long int ans = 0;

	for(int i = 0; i <= 100; i++) {
	for(int j = i; j <= 100; j++) {
	for(int k = j; k <= 100; k++) {
	for(int l = k; l <= 100; l++) {
		if(i + j + k + l == n) {
			int m = (i == j) * 4 + (j == k) * 2 + (k == l);
			ans += 720 / table[m][0] * i * (100 - l);
			ans += 720 / table[m][1] * (100 - l);
			ans += 720 / table[m][2] * i;
			ans += 720 / table[m][3];
		}
	}
	}
	}
	}
	
	printf("%lld\n", ans);
	
	return 0;
}
0