View
1021
//1021번 문제
Scanner Input = new Scanner(System.in);
char[] data = Input.next().toCharArray();
System.out.print(data);
1022
//1022번 문제
Scanner Input = new Scanner(System.in);
char[] data = Input.nextLine().toCharArray();
System.out.print(data);
1023
//1023번 문제
Scanner Input = new Scanner(System.in);
String[] str = Input.nextLine().split("\\.");
int x = Integer.parseInt(str[0]);
int y = Integer.parseInt(str[1]);
System.out.printf("%d",x);
System.out.println();
System.out.printf("%d",y);
//1024번 문제
Scanner Input = new Scanner(System.in);
char[] d = new char[30];
String str = Input.next();
for(int i = 0; i<str.length(); i++){
d[i] = str.charAt(i);
System.out.printf("\'%c\'%n", d[i]);
}
1024
1025
//1025번 문제
Scanner Input = new Scanner(System.in);
String str = Input.next();
for(int i = 0; i< str.length(); i++){
int length = str.length();
int a = (int) Math.pow(10, (length - i - 1));
//입력한 문자의 ASCII Value - '0'(48) = 원래 값
int b = (str.charAt(i) - '0' )*a;
System.out.printf("[%d]%n", b);
}
1026
//1026번 문제
Scanner Input = new Scanner(System.in);
String[] str = (Input.nextLine()).split(":");
System.out.printf("%d:%d:%d",Integer.parseInt(str[0]),Integer.parseInt(str[1]),Integer.parseInt(str[2]));
1027
//1027번 문제
Scanner Input = new Scanner(System.in);
String[] str = (Input.nextLine()).split("\\.");
int year = Integer.parseInt(str[0]);
int month = Integer.parseInt(str[1]);
int day = Integer.parseInt(str[2]);
System.out.printf("%02d-%02d-%04d",day,month,year);
1028
//1028번 문제
Scanner Input = new Scanner(System.in);
long data = Input.nextInt();
System.out.print(data);
1029
//1029번 문제
Scanner Input = new Scanner(System.in);
double d = Input.nextDouble();
System.out.printf("%.11f", d);
1030
//1030번 문제
Scanner Input = new Scanner(System.in);
long data = Input.nextLong();
System.out.println(data);
1031
//1031번 문제
Scanner Input = new Scanner(System.in);
int data = Input.nextInt();
System.out.printf("%o",data);
1032
//1032번 문제
Scanner Input = new Scanner(System.in);
int data = Input.nextInt();
System.out.printf("%x",data);
1033
//1033번 문제
Scanner Input = new Scanner(System.in);
int data = Input.nextInt();
System.out.printf("%X",data);
1034
//1034번 문제
Scanner Input = new Scanner(System.in);
int Data = Input.nextInt();
String ChangeData = Integer.toOctalString(Data);
System.out.println(ChangeData);
1035
//1035번 문제
Scanner Input = new Scanner(System.in);
String Data = Input.next(); //16진수 입력
int temp = Integer.parseInt(Data, 16);// 문자열을 16진수로 바꿈
String ChangeData = Integer.toOctalString(temp);
System.out.println(ChangeData);
1036
//1036번 문제
Scanner Input = new Scanner(System.in);
char Data = Input.next().charAt(0);
System.out.printf("%d", (int)Data);
1037
//1037번 문제
Scanner Input = new Scanner(System.in);
int Data = Input.nextInt();
System.out.printf("%c", (char)Data);
1038
//1038번 문제
Scanner Input = new Scanner(System.in);
String str = Input.nextLine();
String[] ParseStr = str.split(" ");
int x = Integer.parseInt(ParseStr[0]);
int y = Integer.parseInt(ParseStr[1]);
System.out.printf("%d", x+y);
1039
//1039번 문제
Scanner Input = new Scanner(System.in);
String str = Input.nextLine();
String[] ParseStr = str.split(" ");
long x = Long.parseLong(ParseStr[0]);
long y = Long.parseLong(ParseStr[1]);
System.out.printf("%d", x+y);
1040
//1040번 문제
Scanner Input = new Scanner(System.in);
int data = Input.nextInt();
System.out.printf("%d",-data);
'Coding Test > CodeUp1000' 카테고리의 다른 글
Code Up 기초 100제 JAVA 풀이 (1091~1099) (0) | 2021.01.25 |
---|---|
Code Up 기초 100제 JAVA 풀이 (1071~1090) (0) | 2021.01.19 |
Code Up 기초 100제 JAVA 풀이 (1042~1070) (0) | 2021.01.14 |
Code Up 기초 100제 JAVA 풀이 (1001~1020) (0) | 2021.01.03 |
reply