結果

問題 No.587 七対子
ユーザー mag
提出日時 2020-09-06 06:02:27
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 645 bytes
コンパイル時間 1,608 ms
コンパイル使用メモリ 172,704 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-29 06:37:56
合計ジャッジ時間 3,011 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14 WA * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:24:12: warning: 'hoge' may be used uninitialized [-Wmaybe-uninitialized]
   24 |   flagfunc1(flag,hoge,"Impossible");
      |   ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:15:8: note: 'hoge' was declared here
   15 |   char hoge;
      |        ^~~~

ソースコード

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]]++;
  char hoge;
  bool flag=false;
  for(auto itr=map.begin();itr!=map.end();++itr){
   //cout<<"key="<<itr->first<<",val="<<itr->second<<"\n";
   if(!flag&&itr->second==1){
     hoge=itr->first;
     flag=true;
   }
  }
  flagfunc1(flag,hoge,"Impossible");
}
0