結果
| 問題 |
No.587 七対子
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-02 05:08:37 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 389 bytes |
| コンパイル時間 | 321 ms |
| コンパイル使用メモリ | 23,040 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-19 20:05:31 |
| 合計ジャッジ時間 | 1,153 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 35 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:5:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
5 | scanf("%s",str);
| ~~~~~^~~~~~~~~~
main.cpp:13:34: warning: ‘key’ may be used uninitialized in this function [-Wmaybe-uninitialized]
13 | if(cnt1==1 && cnt2==12)printf("%c\n",key);
| ~~~~~~^~~~~~~~~~~~
ソースコード
#include <cstdio>
int main(){
int cnt1=0,cnt2=0;
char str[14],alfa[26]={0},key;
scanf("%s",str);
for(int i=0;i<13;i++){
alfa[str[i]-'a']++;
}
for(int i=0;i<13;i++){
if(alfa[str[i]-'a']==1){cnt1++;key=str[i];}
if(alfa[str[i]-'a']==2)cnt2++;
}
if(cnt1==1 && cnt2==12)printf("%c\n",key);
else printf("Impossible\n");
return 0;
}