반응형

1081번

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

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

		String[] numbers = br.readLine().split(" ");
		int num1 = Integer.parseInt(numbers[0]);
		int num2 = Integer.parseInt(numbers[1]);

		for (int i = 1; i <= num1; i++) {
			for (int j = 1; j <= num2; j++) {
				bw.write(i + " " + j + "\n");
			}
		}

		bw.flush();
		bw.close();

	}
}

 

1082번

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

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

		int hex = Integer.valueOf(br.readLine(), 16);

		for (int i = 1; i < 16; i++) {
			bw.write(Integer.toHexString(hex).toUpperCase() + "*" 
					+ Integer.toHexString(i).toUpperCase()+ "="
					+ Integer.toHexString(hex*i).toUpperCase() + "\n");
		}

		bw.flush();
		bw.close();

	}
}

 

1083번

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

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

		int num = Integer.parseInt(br.readLine());

		for (int i = 1; i <= num; i++) {
			if (i % 3 == 0) {
				bw.write("X" + " ");
			} else {
				bw.write(i + " ");
			}
		}

		bw.flush();
		bw.close();

	}
}

 

1084번

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

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

		String[] numbers = br.readLine().split(" ");

		int num1 = Integer.parseInt(numbers[0]);
		int num2 = Integer.parseInt(numbers[1]);
		int num3 = Integer.parseInt(numbers[2]);

		for (int i = 0; i < num1; i++) {
			for (int j = 0; j < num2; j++) {
				for (int k = 0; k < num3; k++) {
					bw.write(i + " " + j + " " + k);
					bw.newLine();
				}
			}
		}
		
		bw.write(String.valueOf(num1 * num2 * num3));
		bw.flush();
		bw.close();

	}
}

 

1085번

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.math.BigDecimal;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

		String[] numbers = br.readLine().split(" ");

		BigDecimal h = new BigDecimal(numbers[0]);
		BigDecimal b = new BigDecimal(numbers[1]);
		BigDecimal c = new BigDecimal(numbers[2]);
		BigDecimal s = new BigDecimal(numbers[3]);
		
		BigDecimal mb = h.multiply(b).multiply(c).multiply(s);
		
		mb = mb.divide(new BigDecimal("8"))
				.divide(new BigDecimal("1024"))
				.divide(new BigDecimal("1024"));
		
		
		bw.write(String.format("%.1f MB", mb.doubleValue()));
		bw.flush();
		bw.close();

	}
}

 

 

반응형

+ Recent posts