結果
問題 |
No.548 国士無双
|
ユーザー |
![]() |
提出日時 | 2025-03-25 14:52:40 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 642 bytes |
コンパイル時間 | 270 ms |
コンパイル使用メモリ | 27,776 KB |
実行使用メモリ | 7,328 KB |
最終ジャッジ日時 | 2025-03-25 14:52:42 |
合計ジャッジ時間 | 1,658 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 2 WA * 22 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:5:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 5 | scanf("%s",str); | ~~~~~^~~~~~~~~~
ソースコード
#include <stdio.h> int main(){ char str[13]; scanf("%s",str); int type[13]; int num[13]; for(int i = 0;i < 13;i++){ type[i] = i + 97; for(int j = 0;j < 13;j ++){ if(type[i] == (int)str[j]){ num[i]++; } } } int count = 0; for(int i = 0;i < 13;i ++){ if(num[i] > 2){ printf("Impossible"); return 0; }else if(num[i] > 1){ count++; } if(count > 1){ printf("Impossible"); return 0; } } if(count == 0){ for(int i = 0;i < 13;i ++){ printf("%c",str[i]); } }else if(count == 1){ for(int i = 0;i < 13;i ++){ if(num[i] == 0){ printf("%c",str[i]); return 0; } } } }