結果
問題 |
No.587 七対子
|
ユーザー |
![]() |
提出日時 | 2017-11-03 23:02:25 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 683 bytes |
コンパイル時間 | 569 ms |
コンパイル使用メモリ | 54,236 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-22 16:16:23 |
合計ジャッジ時間 | 1,424 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 35 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:26:51: warning: ‘alphabet’ may be used uninitialized [-Wmaybe-uninitialized] 26 | if(numABC[i]==1 && ansChar=='\n') ansChar = alphabet[i]; | ~~~~~~~~^~~~~~~~~~~~~ main.cpp:6:10: note: ‘alphabet’ declared here 6 | char alphabet[26]; | ^~~~~~~~
ソースコード
#include <iostream> using namespace std; int main(){ char a='a'; int A = a; char alphabet[26]; for(int i=A; i<A+26; i++){ alphabet[i]=i; } int numABC[26] = {0}; char S; for(int i=0; i<13; i++){ cin >> S; for(int j=0; j<26; j++){ if(S==alphabet[j])numABC[j]++; } } bool ans=true; char ansChar='\n'; for(int i=0; i<26; i++){ if(numABC[i]>=3 || (numABC[i]==1 && ansChar!='\n')){ ans=false; break; } if(numABC[i]==1 && ansChar=='\n') ansChar = alphabet[i]; } if(ans)cout<<ansChar<<endl; else cout << "Impossible\n"; return 0; }