답안 #598163

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
598163 2022-07-17T18:26:01 Z OttoTheDino Palindromic Partitions (CEOI17_palindromic) C++17
0 / 100
0 ms 212 KB
#include <bits/stdc++.h>
using namespace std;

#define rep(i,s,e)                  for (ll i = s; i <= e; ++i)
#define rrep(i,s,e)                 for (ll i = s; i >= e; --i)
#define pb                          push_back
#define pf                          push_front
#define fi                          first
#define se                          second
#define all(a)                      a.begin(), a.end()
#define len(a)                      (ll)a.size()
typedef long long ll;
typedef pair<ll, ll> ii;
typedef pair<ll, ll> pll;
typedef vector<ii> vii;
typedef vector<ll> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;

const ll mod = 31415926, C = 29;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    int t; cin >> t;

    while (t--) {
        ll p = 1, x = 0, y = 0, ans = 0; 
        string s; cin >> s;
        ll n = len(s);
        rep (i,0,n-1) {

            if (2*i>=n-1) {
                ans++;
                break;
            }

            x = (x+(s[i]-'0')*p)%mod;
            y = (y*C+(s[n-1-i]-'0'))%mod;

            if (x==y) {
                ans += 2;
                p = 1;
                x = y = 0;
            }

            else p = (p * C) % mod;

        }

        cout << ans << "\n";
    }

    return 0;
}

# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -