제출 #1024606

#제출 시각아이디문제언어결과실행 시간메모리
1024606GangstaPalinilap (COI16_palinilap)C++14
0 / 100
1087 ms1008 KiB
#include "bits/stdc++.h"
#define ll long long int
#define pb push_back
#define pii pair<int,int>
#define ff first
#define ss second
#define sz size()

const int N = 2e5 + 1;

using namespace std;

bool barla(string st){
	string st1 = st;
	reverse(st.begin(), st.end());
	if(st == st1) return 1;
	else return 0;
}

int main(){
    ios::sync_with_stdio(false); cin.tie(nullptr);
    //freopen("input.in", "r", stdin);
    //freopen("output.out", "w", stdout);
    ll ans = 0;
    string s;
    cin >> s;
    for(int i = 0; i < (int)s.sz; i++){
    	string m = "";
    	for(int j = i; j < (int)s.sz; j++){
    		m += s[j];
    		if(barla(m)) ans++;
    	}
    }
    cout << ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...