結果
問題 | No.1594 Three Classes |
ユーザー | seven_three |
提出日時 | 2021-07-09 21:35:35 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 706 bytes |
コンパイル時間 | 944 ms |
コンパイル使用メモリ | 91,756 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-16 07:33:32 |
合計ジャッジ時間 | 1,613 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 |
ソースコード
#include <iostream> #include <string> #include <algorithm> #include <vector> #include <iomanip> #include <cmath> #include <stdio.h> #include <queue> #include <deque> #include <cstdio> #include <set> #include <map> #include <bitset> #include <stack> #include <cctype> using namespace std; int n, e[15]; bool bo = false; void func(int now, int a, int b, int c) { if (now == n) { if (a == b && b == c) { bo = true; } return; } func(now + 1, a + e[now], b, c); func(now + 1, a, b + e[now], c); func(now + 1, a, b, c + e[now]); } int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> e[i]; } func(0, 0, 0, 0); if (bo) { cout << "Yes" << endl; } else { cout << "No" << endl; } }