結果

問題 No.3035 2018
ユーザー tanzakutanzaku
提出日時 2018-04-02 00:43:47
言語 Java19
(openjdk 21)
結果
AC  
実行時間 523 ms / 2,000 ms
コード長 2,375 bytes
コンパイル時間 2,227 ms
コンパイル使用メモリ 81,140 KB
実行使用メモリ 80,056 KB
最終ジャッジ日時 2023-09-08 13:11:53
合計ジャッジ時間 8,508 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 508 ms
79,696 KB
testcase_01 AC 520 ms
79,216 KB
testcase_02 AC 523 ms
79,540 KB
testcase_03 AC 519 ms
80,056 KB
testcase_04 AC 506 ms
79,668 KB
testcase_05 AC 512 ms
79,984 KB
testcase_06 AC 511 ms
79,672 KB
testcase_07 AC 500 ms
79,408 KB
testcase_08 AC 518 ms
79,676 KB
testcase_09 AC 495 ms
79,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {
	static int[] primeGap = new int[] {16, 28, 52, 84};
	static int[] factorCount = new int[] {24,24,4,16,80,12,32,16,24,12,96,8,32,4,96,2,48,16,4,80,24,16,16,8,48,32,8,2,48,8,16,16,12,4,48,8,60,24,8,8,48,4,8,16,16,4,64,8,12,32,8,2,160,4,96,12,12,4,64,6,8,16,16,24,72,4,8,16,10,16,32,16,12,16,8,4,64,32,16,32,48,8,12,2,192,4,8,8,48,16,4,24,16,8,32,6,24,32,16,4};
	void solveTestcase(final Scanner in, final PrintWriter out) {
		int max = 5111443;
		int[] cnt = new int[max + 1];
		
		Arrays.fill(cnt, 1);
		for (int i = 2; i < cnt.length; i++) {
			if (cnt[i] == 1) {
				for (int j = i; j < cnt.length; j += i) {
					int x = 1;
					for (int k = j; k % i == 0; k /= i) x++;
					cnt[j] *= x;
				}
			}
		}
//		dump(Arrays.copyOf(cnt, 10));
		
		int n = in.nextInt();
		for (int i = 1, j = 0; ; i++) {
			if (cnt[i] == 4) {
//				dump(++j, i);
				if (++j == n) {
					out.println(i);
					return;
				}
			}
		}
	}
	
	void solve() {
		try (final PrintWriter out = new PrintWriter(System.out)) {
			try (final Scanner in = new Scanner(System.in)) {
//				int t = in.nextInt();
				int t = 1;
				while (t-- > 0) {
					solveTestcase(in, out);
				}
			}
		}
	}

	public static void main(String[] args) {
		new Main().solve();
	}

	// [l,r]
	boolean[] segmentSieve(long l, long r) {
		boolean[] res = new boolean[(int)(r-l+1)];
		boolean[] small = new boolean[(int)Math.sqrt(r)+1];
		Arrays.fill(res, true);
		Arrays.fill(small, true);
		if(l <= 1) res[0] = false;
		if(l <= 0) res[1] = false;
		for(int i = 2; (long)i*i <= r; i++) {
			if(small[i]) {
				if((long)i*i < small.length) {
					for(int j = i*i; j < small.length; j += i) { small[j] = false; }
				}
				{
					long v = (l + i - 1) / i * i;
					int j = (int)((v == i ? v + i : v) - l);
					for(; j < res.length; j += i) {
						res[j] = false;
					}
				}
			}
		}
		return res;
	}
	private static int factorCount(long t) {
		int res = 1;
		for(int i = 2; (long)i*i <= t && res <= 4; i++) {
			int cnt = 1;
			while(t % i == 0) {
				t /= i;
				cnt++;
			}
			res *= cnt;
		}
		
		if(t != 1) {
			res *= 2;
		}
		
		return res;
	}
	
	
	static void dump(Object...objects) { System.err.println(Arrays.deepToString(objects)); }
}
0