회원가입
로그인
Toggle navigation
문제
문제
전체 문제
문제 출처
단계별로 풀어보기
알고리즘 분류
추가된 문제
문제 순위
문제
푼 사람이 한 명인 문제
아무도 못 푼 문제
최근 제출된 문제
최근 풀린 문제
랜덤
출처
ICPC
Olympiad
한국정보올림피아드
한국정보올림피아드시․도지역본선
전국 대학생 프로그래밍 대회 동아리 연합
대학교 대회
카카오 코드 페스티벌
Coder's High
ICPC
Regionals
World Finals
Korea Regional
Africa and the Middle East Regionals
Europe Regionals
Latin America Regionals
North America Regionals
South Pacific Regionals
문제집
대회
채점 현황
게시판
그룹
더 보기
재채점 기록
블로그
도움말
전체
공지
자유
질문
오타/오역/요청
게시판 공지
홍보
업데이트
solved.ac
글쓰기
질문 도움말
자주묻는 질문
반례가 있을까요?
2941번 - 크로아티아 알파벳
leehyun1165
3년 전
0
해당 코드의 반례가 있을까요.. ?
import java.util.*; public class Main { public static void main(String[] args) { Scanner s = new Scanner(System.in); String word= s.nextLine(); int count = 0; int i = 0; while (i < word.length()) { if (i < word.length() - 2) { String currentThreeChars = word.substring(i, i + 3); if (currentThreeChars.equals("dz=")) { i += 3; count++; continue; } } // 해당 index에서 추가로 뒤에 두 개 글자를 더 읽었을 때->한글자로 읽어져야 하는게 있는지 check if (i < word.length() - 1) { String currentTwoChars = word.substring(i, i + 2); if (currentTwoChars.equals("c=") || currentTwoChars.equals("c-") || currentTwoChars.equals("dz") || currentTwoChars.equals("d-") || currentTwoChars.equals("lj") || currentTwoChars.equals("nj") || currentTwoChars.equals("s=") || currentTwoChars.equals("z=")) { i += 2; count++; continue; } } // 해당 index에서 추가로 뒤에 1개를 더 읽었을 떄 -> 한글자로 읽어져야 하는게 있는지 check i++; count++;// 2->1 3->1 개의 예외가 없을 경우 1개가 1개의 글자로 count } System.out.println(count); } }
댓글을 작성하려면
로그인
해야 합니다.
leehyun1165 3년 전
해당 코드의 반례가 있을까요.. ?