結果

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n;
    int count = 0;
    string s;

    cin >> n >> s;
    
    for(int i = 0; i < n; i++){
        for(int t = i + 1; t < n; t++){
            if(s.at(i) != s.at(t))continue;
            
            for(int a = i + 1; a < t; a++){
                if(s.at(a) == s.at(i))continue; 
                
                for(int b = t + 1; b < s.size(); b++){
                    if(s.at(a) == s.at(b) || s.at(b) == s.at(i))continue;
                    
                    for(int c = b + 1; c < s.size(); c++){
                        if(s.at(c) != s.at(b) && s.at(c) != s.at(a) && s.at(c) != s.at(i))count++;
                    }
                }
            }
        }
    }

    cout << count << endl;


    
    return 0;
}
0