結果

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
 
int main() {
int N;
cin>>N;
string S;
char a,b,c,d,e;
cin>>S;
int t=0;
if(N<5)
cout<<0<<endl;
else{
	for(int v=0;v<N-4;v++){
		for(int w=v+1;w<N-3;w++){
			for(int x=w+1;x<N-2;x++){
				for(int y=x+1;y<N-1;y++){
					for(int z=y+1;z<N;z++){
					a=S.at(v);
					b=S.at(w);
					c=S.at(x);
					d=S.at(y);
					e=S.at(z);
				
					if(a==c && a!=b && a!=d && a!=e && b!=d && b!=e && d!=e)
					t++;
					}
				}
			}
		}
	}
	
	

cout<<t<<endl;	
	
}
}
0