結果

問題 No.398 ハーフパイプ(2)
ユーザー finefine
提出日時 2017-03-14 02:35:33
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,161 bytes
コンパイル時間 1,639 ms
コンパイル使用メモリ 166,584 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-09 23:10:55
合計ジャッジ時間 2,465 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int hoge(int a, int b, int c, int d, int i, int j) {
	return a * i * (100 - j) + b * i + c * (100 - j) + d;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	double X;
	cin >> X;
	int sum = (int)(X * 4);
	ll ans = 0;
	for (int i = 0; i <= 100; i++) {
		for (int k = i; k <= 100; k++) {
			for (int l = k; l <= 100; l++) {
				int j = sum - i - k - l;
				if (j < 0 || j > 100 || l > j) continue;
				if (i == k) {
					if (k == l) {
						if (l == j) {
							ans += hoge(30, 6, 6, 1, i, j);
						} else {
							ans += hoge(120, 60, 30, 15, i, j);
						}
					} else {
						if (l == j) {
							ans += hoge(180, 60, 60, 20, i, j);
						} else {
							ans += hoge(360, 180, 120, 60, i, j);
						}
					}
				} else {
					if (k == l) {
						if (l == j) {
							ans += hoge(120, 30, 60, 15, i, j);
						} else {
							ans += hoge(360, 180, 180, 90, i, j);
						}
					} else {
						if (l == j) {
							ans += hoge(360, 120, 180, 60, i, j);
						} else {
							ans += hoge(720, 360, 360, 180, i, j);
						}
					}
				}
			}
		}
	}
	cout << ans << endl;
	return 0;
}
0