package programmers.lv1;
public class 크기가작은부분문자열 {
public static int solution(String t, String p){
int answer = 0;
for(int i = 0; i<t.length()-p.length()+1; i++){
String temp = t.substring(i, i+p.length());
System.out.println(temp);
Long tempLong = Long.parseLong(temp);
if(tempLong <= Long.parseLong(p)){
answer ++;
}
}
return answer;
}
public static void main(String[] args) {
int answer = solution("10203", "15");
System.out.println(answer);
}
}
반응형
'(문제풀이)' 카테고리의 다른 글
백준 11382(Java) - 꼬마 정민 (0) | 2023.08.20 |
---|---|
프로그래머스 - 푸드 파이트 대회(Java) (0) | 2023.08.13 |
백준 2164_카드2 (0) | 2023.06.06 |
백준 9012_괄호 (0) | 2023.06.05 |
백준 11728_배열 합치기 (0) | 2023.06.05 |