結果

問題 No.1229 ラグビーの得点パターン
ユーザー CELICA
提出日時 2020-09-18 21:55:44
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 592 bytes
コンパイル時間 1,324 ms
コンパイル使用メモリ 165,980 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-22 09:30:22
合計ジャッジ時間 2,092 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ul = unsigned long;
using ull = unsigned long long;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	int n;
	cin >> n;

	ll res{ 0 };
	if (n > 0)
	{
		for (int i = 0; i <= n / 5; ++i)
		{
			if (i * 5 == n)
			{
				++res;
				break;
			}

			for (int j = 0; j <= i; ++j)
			{
				int sum = i * 5 + j * 2;
				if (sum == n)
				{
					++res;
					break;
				}
				else if (sum > n)
					break;
				if ((n - sum) % 3 == 0)
					++res;
			}
		}
	}
	else
		res = 1;

	cout << res << "\n";

	return 0;
}
0