結果
問題 |
No.785 色食い虫
|
ユーザー |
|
提出日時 | 2019-09-14 08:10:00 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,230 bytes |
コンパイル時間 | 1,339 ms |
コンパイル使用メモリ | 171,604 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-05 07:16:19 |
合計ジャッジ時間 | 2,201 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
/** @file 785.cpp @title No.785 色食い虫 - yukicoder @url https://yukicoder.me/problems/no/785 **/ #include <bits/stdc++.h> using namespace std; typedef long long LL; #define ALL(obj) (obj).begin(), (obj).end() #define REP(i, N) for (int i = 0; i < (N); ++i) vector<string> split(string S, string separator) { auto separator_length = separator.length(); auto list = vector<string>(); auto offset = string::size_type(0); while (1) { auto pos = S.find(separator, offset); if (pos == string::npos) { list.push_back(S.substr(offset)); break; } list.push_back(S.substr(offset, pos - offset)); offset = pos + separator_length; } return list; } int main() { string R, G, B; cin >> R >> G >> B; int numR, numG, numB; if (R == "NONE") { numR = 16; } else { auto tmp = split(R, ","); numR = 16 - (int)tmp.size(); } if (G == "NONE") { numG = 16; } else { auto tmp = split(G, ","); numG = 16 - (int)tmp.size(); } if (B == "NONE") { numB = 16; } else { auto tmp = split(B, ","); numB = 16 - (int)tmp.size(); } LL ans = (numR * numG * numB) * (numR * numG * numB); cout << ans << endl; return 0; }