結果

問題 No.3110 Like CPCTF?
ユーザー sai
提出日時 2025-04-18 21:41:15
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 878 bytes
コンパイル時間 2,836 ms
コンパイル使用メモリ 274,856 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-04-18 21:41:19
合計ジャッジ時間 3,381 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n;
  std::string s;
  std::cin >> n >> s;
  int ans = 0;
  for (int a = 0; a < n; a++) {
    for (int b = a + 1; b < n; b++) {
      for (int c = b + 1; c < n; c++) {
        for (int d = c + 1; d < n; d++) {
          for (int e = d + 1; e < n; e++) {
            if (s[a] != s[c]) {
              continue;
            }
            if (s[a] == s[b] || s[a] == s[d] || s[a] == s[e]) {
              continue;
            }
            if (s[b] == s[c] || s[b] == s[d] || s[b] == s[e]) {
              continue;
            }
            if (s[c] == s[d] || s[c] == s[e]) {
              continue;
            }
            if (s[d] == s[e]) {
              continue;
            }
            ans++;
          }
        }
      }
    }
  }
  std::cout << ans << '\n';
}
0