We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
회문 (KOI 2019)
### 풀이 언어 - python/java ### 코드 ```python/java ``` ### 핵심 로직 혹은 자료구조 - ### 시간 복잡도 - O( )
The text was updated successfully, but these errors were encountered:
import java.io.*; class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int t = Integer.parseInt(br.readLine()); StringBuilder sb = new StringBuilder(); while (t--> 0) { String line = br.readLine(); sb.append(search(line, 0, line.length() - 1 ,0)).append('\n'); } System.out.println(sb); } private static int search(String s, int left, int right, int count) { if (count == 2) { return 2; } int result = count; while (left < right) { if (s.charAt(left) != s.charAt(right)) { result = Math.min(search(s, left + 1, right, count + 1), search(s, left, right - 1, count + 1)); break; } left++; right--; } return result; } }
Sorry, something went wrong.
CMSSKKK
No branches or pull requests
TITLE
회문
(KOI 2019)
LINK
📷 Screenshots
댓글 양식
The text was updated successfully, but these errors were encountered: