반응형
# 1023
import java.util.Scanner;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String num = sc.nextLine();
StringTokenizer token = new StringTokenizer(num, ".");
int[] nums = new int[2];
int i = 0;
while (token.hasMoreTokens()) {
nums[i] = Integer.parseInt(token.nextToken());
i += 1;
}
String front = String.format("%d", nums[0]);
String back = String.format("%d", nums[1]);
System.out.println(front);
System.out.println(back);
}
}
# 1024
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String word = sc.nextLine();
char[] arrWord = word.toCharArray();
for (int i = 0; i < arrWord.length; i++) {
System.out.println("\'"+arrWord[i]+ "\'");
}
}
}
# 1025
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String num = sc.nextLine();
char[] numArr = num.toCharArray();
System.out.println("[" + numArr[0] + "0000" + "]");
System.out.println("[" + numArr[1] + "000" + "]");
System.out.println("[" + numArr[2] + "00" + "]");
System.out.println("[" + numArr[3] + "0" + "]");
System.out.println("[" + numArr[4] + "]");
}
}
# 1026
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String date = sc.nextLine();
String[] dateArr = date.split("\\:");
int minutes = Integer.parseInt(dateArr[1]);
System.out.println(minutes);
}
}
# 1027
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String date = sc.next();
String[] dateArr = date.split("\\.");
System.out.println(dateArr[2] + "-" + dateArr[1] + "-" + dateArr[0]);
}
}
# 1028
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long num = sc.nextLong();
System.out.println(num);
}
}
# 1029
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
double num = sc.nextDouble();
System.out.println(String.format("%.11f", num));
}
}
# 1030
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long num = sc.nextLong();
System.out.println(num);
}
}
# 1031
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int num = sc.nextInt();
String numOctal = Integer.toOctalString(num);
System.out.println(numOctal);
}
}
# 1032
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int num = sc.nextInt();
String numOctal = Integer.toHexString(num);
System.out.println(numOctal);
}
}
반응형
'개인 공부 > JAVA' 카테고리의 다른 글
[JAVA] Code Up 기초 100제 (1063 ~ 1072) (0) | 2021.06.23 |
---|---|
[JAVA] Code Up 기초 100제 (1053 ~ 1062) (0) | 2021.06.22 |
[JAVA] Code Up 기초 100제 (1043 ~ 1052) (0) | 2021.06.21 |
[JAVA] Code Up 기초 100제 (1033 ~ 1042) (0) | 2021.06.20 |
[JAVA] Code Up 기초 100제 (1001 ~ 1011) (0) | 2021.06.18 |