RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
ICPC00067

K. String Theory

Unrated 레이팅 미적용
난이도
2s
시간 제한
1024MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

Nested quotations are great not only for writing literature with a complex narrative structure, but also in programming languages. While it may seem necessary to use different quotation marks at different nesting levels for clarity, there is an alternative. We can display various nesting levels using \(k-qu\)otations, which are defined as follows. A \(1-qu\)otation is a string that begins with a quote character, ends with another quote character and contains no quote characters \(in-be\)tween. These are just the usual (unnested) quotations. For example, 'this is a string' is a \(1-qu\)otation. For \(k > 1\), a \(k-qu\)otation is a string that begins with \(k\) quote characters, ends with another \(k\) quote characters and contains a nested string \(in-be\)tween. The nested string is a n\(on-em\)pty sequence of (\(k - 1\))-quotations, which may be preceded, separated, a\(nd/or\) succeeded by any number of n\(on-qu\)ote characters. For example, ''All 'work' and no 'play''' is a \(2-qu\)otation. Given a description of a string, you must determine its maximum possible nesting level.

제약
입력 형식

The input consists of two lines. The first line contains an integer \(n\) (\(1 \le n \le 100\)). The second line contains \(n\) integers \(a_{1}\), a_{2}, . . . , a_{n} (\(1 \le a_{i} \le 100\)), which describe a string as follows. The string starts with \(a\)1 quote characters, which are followed by a positive number of n\(on-qu\)ote characters, which are followed by \(a\)2 quote characters, which are followed by a positive number of n\(on-qu\)ote characters, and so on, until the string ends with \(an\) quote characters.

출력 형식

Display the largest number \(k\) such that a string described by the input is a \(k-qu\)otation. If there is no such \(k\), display no quotation instead.

예제 1
입력
5
2 1 1 1 3
출력
2
예제 2
입력
1
22
출력
4
예제 3
입력
1
1
출력
no quotation
문제 정보

생성자가 기록되지 않았습니다.

출처 ICPC World Finals 2016

평가 및 의견

K. String Theory

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

K. String Theory

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8