結果

問題 No.2201 p@$$w0rd
ユーザー hatsuka_iwa
提出日時 2023-04-08 03:34:03
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 463 bytes
コンパイル時間 1,536 ms
コンパイル使用メモリ 167,188 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-10-03 01:27:38
合計ジャッジ時間 2,389 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S; cin >> S;
  int LO = 0, AS = 0;

  auto P = [](auto P, int N) -> int {
    if (N == 0) return 1;
    int T = P(P, N / 2);
    if (N % 2 == 0) return T * T;
    return T * T * 2;
  };

  for (char C : S) {
    if (C == 'l' || C == 'o') LO++;
    if (C == 'a' || C == 's') AS++;
  }

  int Ans = (P(P, LO) - 1) * (P(P, AS) - 1);
  cout << (LO + AS == 8 && Ans != 0 ? Ans - 1 : Ans) << endl;
}
0