반응형

1031번

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 octNum = Integer.parseInt(br.readLine());

		System.out.println(Integer.toOctalString(octNum));

	}
}

 

1032번

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 hexNum = Integer.parseInt(br.readLine());

		System.out.println(Integer.toHexString(hexNum));

	}
}

 

1033번

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 hexNum = Integer.parseInt(br.readLine());

		System.out.println(Integer.toHexString(hexNum).toUpperCase());

	}
}

 

1034번

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 octNum = br.readLine();

		System.out.println(Integer.valueOf(octNum, 8));

	}
}

 

1035번

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 hexNum = br.readLine();
		int decNum = Integer.valueOf(hexNum, 16);
		String octNum = Integer.toOctalString(decNum);

		System.out.println(octNum);

	}
}

 

반응형

+ Recent posts