結果

問題 No.2201 p@$$w0rd
ユーザー chro_96
提出日時 2023-02-03 21:29:59
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 619 bytes
コンパイル時間 1,173 ms
コンパイル使用メモリ 29,696 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-02 19:13:21
合計ジャッジ時間 1,955 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <string.h>

int main () {
  char s[9] = "";
  
  int res = 0;
  
  int ans = 0;
  int len = 0;
  
  res = scanf("%s", s);
  len = strlen(s);
  
  for (int i = 0; i < (1<<len)-1; i++) {
    int sign = 0;
    int num = 0;
    int is_ok = 1;
    for (int j = 0; j < len; j++) {
      if ((i&(1<<j)) > 0 && (s[j] == 'l' || s[j] == 'o')) {
        num++;
      } else if ((i&(1<<j)) > 0 && (s[j] == 's' || s[j] == 'a')) {
        sign++;
      } else if ((i&(1<<j)) > 0) {
        is_ok = 0;
      }
    }
    if (is_ok*sign*num > 0) {
      ans++;
    }
  }
  printf("%d\n", ans);
  return 0;
}
0