제출 #751535

#제출 시각아이디문제언어결과실행 시간메모리
751535FidanPalindromic Partitions (CEOI17_palindromic)C++17
60 / 100
10018 ms4192 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define rep(i, a, b) for(ll i=ll(a); i<ll(b); i++) #define repn(i, a, b) for(ll i=ll(b)-1; i>=ll(a); i--) #define be begin() #define en end() #define ff first #define ss second #define si size() const ll mod=(1e9)+7; void solve(){ string s; cin>>s; ll n=s.si; ll l=0, h=n-1; string s1="", s2=""; ll sum=0; while(l<h){ s1+=s[l]; s2=s[h]+s2; if(s1==s2){ sum+=2; s1="", s2=""; } l++, h--; } if(s1.si>0) sum++; else if(l==h) sum++; cout<<sum<<'\n'; } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); ll t=1; cin>>t; while(t--){ solve(); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...