結果
問題 | No.1934 Four Fruits |
ユーザー | orange navle |
提出日時 | 2022-05-13 21:44:27 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 12 ms / 2,000 ms |
コード長 | 2,123 bytes |
コンパイル時間 | 1,863 ms |
コンパイル使用メモリ | 199,744 KB |
最終ジャッジ日時 | 2025-01-29 06:44:27 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 7 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long LL; typedef long double LD; #define rep(i,n) for(LL i=0;i<(n);i++) template <class T> void output(vector<T> &data){ rep(i,data.size()){ cout << data.at(i) << " "; } cout << endl; } template<> void output(vector<string> &data){ rep(i,data.size()){ cout << data.at(i) << endl; } } template <class T> void output(vector<vector<T>> &data){ rep(i,data.size()){ rep(j,data.at(i).size()){ cout << data.at(i).at(j) << " "; } cout << endl; } } template <> void output(vector<vector<bool>> &data){ rep(i,data.size()){ rep(j,data.at(i).size()){ if(data.at(i).at(j)){ cout << "*"; } else{ cout << "-"; } } cout << endl; } } template<class T> void input(vector<T> &data,LL n){ rep(i,n){ LL a; cin >> a; data.push_back(a); } } template<> void input(vector<string> &data,LL n){ rep(i,n){ string s; cin >> s; data.push_back(s); } } template<class T> void input(vector<vector<T>> &data,LL h, LL w){ rep(i,h){ vector<T> add; rep(j,w){ T a; cin >> a; add.push_back(a); } data.push_back(add); } } int main(){ vector<int> data(4); rep(i,3){ int a; cin >> a; data.at(a)++; } bool full = false; int full_pos = -1; int zero_pos = -1; int one_pos = -1; int two_pos = -1; rep(i,data.size()){ if(data.at(i) == 0){ zero_pos = i; } else if(data.at(i) == 1){ one_pos = i; } else if(data.at(i) == 2){ two_pos = i; } else if(data.at(i) == 3){ full_pos = i; } } int ans = -1; if(full_pos != -1){ ans = full_pos; } else if(two_pos != -1){ ans = one_pos; } else{ ans = zero_pos; } cout << ans << endl; return 0; }