https://www.acmicpc.net/problem/2908
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int x = in.nextInt();
int y = in.nextInt();
int xx = flip(x);
int yy = flip(y);
System.out.println(xx > yy ? xx : yy);
}
public static int flip(int num){
int result=0;
while(num!=0){
result= result * 10 + num % 10;
num /= 10;
}
return result;
}
}
https://www.acmicpc.net/problem/5622
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String x = in.nextLine();
int time = 0;
for(int i=0; i<x.length(); i++) {
if(x.charAt(i) < 83 ) {
time += (((x.charAt(i) - 62) / 3) + 2);
}
else if(x.charAt(i) >= 83 && x.charAt(i) < 90){
time += (((x.charAt(i) - 63) / 3) + 2);
}
else {
time += 10;
}
}
System.out.println(time);
}
}
https://www.acmicpc.net/problem/10809
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String x = in.nextLine();
int count = 0;
int arr[] = new int[26];
for(int i=0; i<26; i++) {
arr[i] = -1;
}
for(int i=0; i< x.length(); i++) {
if(arr[x.charAt(i)-97] == -1) {
arr[x.charAt(i)-97] = count;
}
count++;
}
for(int i=0; i<26; i++) {
System.out.print(arr[i] + " ");
}
}
}
'Java-Study' 카테고리의 다른 글
Java Study : 7주차 - 백준 문제풀이 (0) | 2022.12.23 |
---|---|
Java Stduy : 7주차 정리 - 기본 클래스(Object, String, Wrapper, Class 클래스) (0) | 2022.12.23 |
Java Study : 6주차 정리 - 인터페이스 (0) | 2022.12.09 |
Java Study : 5주차 - 백준 문제풀이 (0) | 2022.12.02 |
Java Study : 5주차 정리 - 추상 클래스 (1) | 2022.12.02 |