結果

問題 No.587 七対子
ユーザー michonz4
提出日時 2019-12-26 08:28:33
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 417 bytes
コンパイル時間 389 ms
コンパイル使用メモリ 29,696 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-19 20:02:32
合計ジャッジ時間 1,232 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

int main() {
  int arr[26]={}, i;
  char s[15];
  scanf("%s", s);

  for (i=0; s[i]!='\0'; i++) {
    arr[s[i]-'a']++;
  }

  int one, onecnt=0, twocnt=0;
  for (i=0; i<26; i++) {
    if (arr[i]==1) {
      onecnt++;
      one=i;
    } else if (arr[i]>2) {
      twocnt=1;
    }
  }

  if (onecnt>1 || twocnt) {
    printf("Impossible\n");
  } else {
    printf("%c\n", one+'a');
  }
  return 0;
}
0