結果

問題 No.3381 Palindrome Substrings (C++)
コンテスト
ユーザー Rho
提出日時 2025-11-21 23:20:06
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 19 ms / 2,000 ms
コード長 273 bytes
コンパイル時間 1,587 ms
コンパイル使用メモリ 195,772 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-11-22 12:39:22
合計ジャッジ時間 3,716 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int main(){
	int n;
	cin>>n;
	string s;
	cin>>s;
	int a=0;
	rep(i,n){
		rep(j,n-i){
			string t=s.substr(i,j+1),u=t;
			reverse(u.begin(),u.end());
			if(t==u)a++;
		}
	}
	cout<<a<<endl;

}
0