반응형

1017번

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int number = Integer.parseInt(br.readLine());
		System.out.print(number + " " + number + " " + number);
	}
}

 

1018번

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] time = br.readLine().split(":");
		System.out.print(time[0] + ":" + time[1]);
	}
}

 

1019번

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] time = br.readLine().split("\\.");
		String year = time[0];
		String month = time[1];
		String day = time[2];

		StringBuilder sb = new StringBuilder();

		if (year.length() == 2) {
			sb.append("00" + year);
		} else {
			sb.append(year);
		}

		if (month.length() == 1) {
			sb.append("." + "0" + month);
		} else {
			sb.append("." + month);
		}

		if (day.length() == 1) {
			sb.append("." + "0" + day);
		} else {
			sb.append("." + day);
		}

		System.out.print(sb.toString());

	}
}

 

1020번

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] numbers = br.readLine().split("-");

		System.out.print(numbers[0] + numbers[1]);
	}
}
반응형

+ Recent posts