結果

問題 No.587 七対子
ユーザー mag
提出日時 2020-09-06 06:12:24
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 667 bytes
コンパイル時間 1,669 ms
コンパイル使用メモリ 173,968 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-19 20:18:45
合計ジャッジ時間 2,697 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;
using ll=long long;
#define rep2(i, a, n) for(int i = (a); i < (n); i++)
#define rep(i, n) rep2(i,0,n)

template<typename S,typename T,typename U>void flagfunc1(S flag,T A,U B){flag?cout<<A<<'\n':cout<<B<<'\n';}

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  string s;cin>>s;
  map<char,int> map;
  rep(i,13)map[s[i]]++;
  int cnt=0;
  char hoge;
  for(auto itr=map.begin();itr!=map.end();++itr){
   //cout<<"key="<<itr->first<<",val="<<itr->second<<"\n";
   if(itr->second==1){
     hoge=itr->first;
   }else if(itr->second>2){
     break;
   }
   cnt++;
  }
  flagfunc1(cnt==7,hoge,"Impossible");
}
0