結果

問題 No.3110 Like CPCTF?
ユーザー karinohito
提出日時 2025-05-05 13:25:07
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 579 bytes
コンパイル時間 3,216 ms
コンパイル使用メモリ 275,988 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-05-05 13:25:51
合計ジャッジ時間 4,129 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll=long long;

void solve(){
	ll N;
	string S;
	cin>>N>>S;
	ll an=0;
	
	for(int i=0;i<N;i++){
		for(int j=i+1;j<N;j++){
			if(S[i]==S[j])continue;
			for(int k=j+1;k<N;k++){
				if(S[i]!=S[k])continue;
				for(int l=k+1;l<N;l++){
					if(S[i]==S[l]||S[l]==S[j])continue;
					for(int m=l+1;m<N;m++){
						if(S[i]==S[m]||S[l]==S[m]||S[j]==S[m])continue;
						an++;
					}
				}
			}
		}
	}
	cout<<an<<endl;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
	
	ll T=1;
	// cin>>T;
	while(T--)
	solve();

}

0