結果

問題 No.677 10^Nの約数
ユーザー yusukeyusuke
提出日時 2020-05-04 15:18:35
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 987 ms / 2,000 ms
コード長 9,326 bytes
コンパイル時間 971 ms
コンパイル使用メモリ 119,596 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-22 06:54:20
合計ジャッジ時間 3,203 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 1 ms
6,944 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 1 ms
6,944 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 1 ms
6,940 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 4 ms
6,940 KB
testcase_12 AC 11 ms
6,940 KB
testcase_13 AC 33 ms
6,940 KB
testcase_14 AC 100 ms
6,940 KB
testcase_15 AC 311 ms
6,944 KB
testcase_16 AC 987 ms
6,940 KB
testcase_17 AC 1 ms
6,940 KB
testcase_18 AC 1 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

void main() {
	auto r17 = [1, 2, 4, 5, 8, 10, 16, 20, 25, 32, 40, 50, 64, 80, 100, 125, 128, 160, 200, 250, 256, 320, 400, 500, 512, 625, 640, 800, 1000, 1024, 1250, 1280, 1600, 2000, 2048, 2500, 2560, 3125, 3200, 4000, 4096, 5000, 5120, 6250, 6400, 8000, 8192, 10000, 10240, 12500, 12800, 15625, 16000, 16384, 20000, 20480, 25000, 25600, 31250, 32000, 32768, 40000, 40960, 50000, 51200, 62500, 64000, 65536, 78125, 80000, 81920, 100000, 102400, 125000, 128000, 131072, 156250, 160000, 163840, 200000, 204800, 250000, 256000, 312500, 320000, 327680, 390625, 400000, 409600, 500000, 512000, 625000, 640000, 655360, 781250, 800000, 819200, 1000000, 1024000, 1250000, 1280000, 1562500, 1600000, 1638400, 1953125, 2000000, 2048000, 2500000, 2560000, 3125000, 3200000, 3276800, 3906250, 4000000, 4096000, 5000000, 5120000, 6250000, 6400000, 7812500, 8000000, 8192000, 9765625, 10000000, 10240000, 12500000, 12800000, 15625000, 16000000, 16384000, 19531250, 20000000, 20480000, 25000000, 25600000, 31250000, 32000000, 39062500, 40000000, 40960000, 48828125, 50000000, 51200000, 62500000, 64000000, 78125000, 80000000, 81920000, 97656250, 100000000, 102400000, 125000000, 128000000, 156250000, 160000000, 195312500, 200000000, 204800000, 244140625, 250000000, 256000000, 312500000, 320000000, 390625000, 400000000, 409600000, 488281250, 500000000, 512000000, 625000000, 640000000, 781250000, 800000000, 976562500, 1000000000, 1024000000, 1220703125, 1250000000, 1280000000, 1562500000, 1600000000, 1953125000, 2000000000, 2048000000, 2441406250, 2500000000, 2560000000, 3125000000, 3200000000, 3906250000, 4000000000, 4882812500, 5000000000, 5120000000, 6103515625, 6250000000, 6400000000, 7812500000, 8000000000, 9765625000, 10000000000, 10240000000, 12207031250, 12500000000, 12800000000, 15625000000, 16000000000, 19531250000, 20000000000, 24414062500, 25000000000, 25600000000, 30517578125, 31250000000, 32000000000, 39062500000, 40000000000, 48828125000, 50000000000, 51200000000, 61035156250, 62500000000, 64000000000, 78125000000, 80000000000, 97656250000, 100000000000, 122070312500, 125000000000, 128000000000, 152587890625, 156250000000, 160000000000, 195312500000, 200000000000, 244140625000, 250000000000, 256000000000, 305175781250, 312500000000, 320000000000, 390625000000, 400000000000, 488281250000, 500000000000, 610351562500, 625000000000, 640000000000, 762939453125, 781250000000, 800000000000, 976562500000, 1000000000000, 1220703125000, 1250000000000, 1280000000000, 1525878906250, 1562500000000, 1600000000000, 1953125000000, 2000000000000, 2441406250000, 2500000000000, 3051757812500, 3125000000000, 3200000000000, 3906250000000, 4000000000000, 4882812500000, 5000000000000, 6103515625000, 6250000000000, 6400000000000, 7812500000000, 8000000000000, 9765625000000, 10000000000000, 12207031250000, 12500000000000, 15625000000000, 16000000000000, 19531250000000, 20000000000000, 24414062500000, 25000000000000, 31250000000000, 32000000000000, 39062500000000, 40000000000000, 48828125000000, 50000000000000, 62500000000000, 78125000000000, 80000000000000, 97656250000000, 100000000000000, 125000000000000, 156250000000000, 160000000000000, 195312500000000, 200000000000000, 250000000000000, 312500000000000, 390625000000000, 400000000000000, 500000000000000, 625000000000000, 781250000000000, 800000000000000, 1000000000000000, 1250000000000000, 1562500000000000, 2000000000000000, 2500000000000000, 3125000000000000, 4000000000000000, 5000000000000000, 6250000000000000, 10000000000000000, 12500000000000000, 20000000000000000, 25000000000000000, 50000000000000000, 100000000000000000];
	auto r18 = [1, 2, 4, 5, 8, 10, 16, 20, 25, 32, 40, 50, 64, 80, 100, 125, 128, 160, 200, 250, 256, 320, 400, 500, 512, 625, 640, 800, 1000, 1024, 1250, 1280, 1600, 2000, 2048, 2500, 2560, 3125, 3200, 4000, 4096, 5000, 5120, 6250, 6400, 8000, 8192, 10000, 10240, 12500, 12800, 15625, 16000, 16384, 20000, 20480, 25000, 25600, 31250, 32000, 32768, 40000, 40960, 50000, 51200, 62500, 64000, 65536, 78125, 80000, 81920, 100000, 102400, 125000, 128000, 131072, 156250, 160000, 163840, 200000, 204800, 250000, 256000, 262144, 312500, 320000, 327680, 390625, 400000, 409600, 500000, 512000, 625000, 640000, 655360, 781250, 800000, 819200, 1000000, 1024000, 1250000, 1280000, 1310720, 1562500, 1600000, 1638400, 1953125, 2000000, 2048000, 2500000, 2560000, 3125000, 3200000, 3276800, 3906250, 4000000, 4096000, 5000000, 5120000, 6250000, 6400000, 6553600, 7812500, 8000000, 8192000, 9765625, 10000000, 10240000, 12500000, 12800000, 15625000, 16000000, 16384000, 19531250, 20000000, 20480000, 25000000, 25600000, 31250000, 32000000, 32768000, 39062500, 40000000, 40960000, 48828125, 50000000, 51200000, 62500000, 64000000, 78125000, 80000000, 81920000, 97656250, 100000000, 102400000, 125000000, 128000000, 156250000, 160000000, 163840000, 195312500, 200000000, 204800000, 244140625, 250000000, 256000000, 312500000, 320000000, 390625000, 400000000, 409600000, 488281250, 500000000, 512000000, 625000000, 640000000, 781250000, 800000000, 819200000, 976562500, 1000000000, 1024000000, 1220703125, 1250000000, 1280000000, 1562500000, 1600000000, 1953125000, 2000000000, 2048000000, 2441406250, 2500000000, 2560000000, 3125000000, 3200000000, 3906250000, 4000000000, 4096000000, 4882812500, 5000000000, 5120000000, 6103515625, 6250000000, 6400000000, 7812500000, 8000000000, 9765625000, 10000000000, 10240000000, 12207031250, 12500000000, 12800000000, 15625000000, 16000000000, 19531250000, 20000000000, 20480000000, 24414062500, 25000000000, 25600000000, 30517578125, 31250000000, 32000000000, 39062500000, 40000000000, 48828125000, 50000000000, 51200000000, 61035156250, 62500000000, 64000000000, 78125000000, 80000000000, 97656250000, 100000000000, 102400000000, 122070312500, 125000000000, 128000000000, 152587890625, 156250000000, 160000000000, 195312500000, 200000000000, 244140625000, 250000000000, 256000000000, 305175781250, 312500000000, 320000000000, 390625000000, 400000000000, 488281250000, 500000000000, 512000000000, 610351562500, 625000000000, 640000000000, 762939453125, 781250000000, 800000000000, 976562500000, 1000000000000, 1220703125000, 1250000000000, 1280000000000, 1525878906250, 1562500000000, 1600000000000, 1953125000000, 2000000000000, 2441406250000, 2500000000000, 2560000000000, 3051757812500, 3125000000000, 3200000000000, 3814697265625, 3906250000000, 4000000000000, 4882812500000, 5000000000000, 6103515625000, 6250000000000, 6400000000000, 7629394531250, 7812500000000, 8000000000000, 9765625000000, 10000000000000, 12207031250000, 12500000000000, 12800000000000, 15258789062500, 15625000000000, 16000000000000, 19531250000000, 20000000000000, 24414062500000, 25000000000000, 30517578125000, 31250000000000, 32000000000000, 39062500000000, 40000000000000, 48828125000000, 50000000000000, 61035156250000, 62500000000000, 64000000000000, 78125000000000, 80000000000000, 97656250000000, 100000000000000, 122070312500000, 125000000000000, 156250000000000, 160000000000000, 195312500000000, 200000000000000, 244140625000000, 250000000000000, 312500000000000, 320000000000000, 390625000000000, 400000000000000, 488281250000000, 500000000000000, 625000000000000, 781250000000000, 800000000000000, 976562500000000, 1000000000000000, 1250000000000000, 1562500000000000, 1600000000000000, 1953125000000000, 2000000000000000, 2500000000000000, 3125000000000000, 3906250000000000, 4000000000000000, 5000000000000000, 6250000000000000, 7812500000000000, 8000000000000000, 10000000000000000, 12500000000000000, 15625000000000000, 20000000000000000, 25000000000000000, 31250000000000000, 40000000000000000, 50000000000000000, 62500000000000000, 100000000000000000, 125000000000000000, 200000000000000000, 250000000000000000, 500000000000000000, 1000000000000000000];
	auto N = rl;
	if(N == 18) r18.each!writeln;
	else if(N == 17) r17.each!writeln;
	else {
		getDivisors(10 ^^ N).each!writeln;
	}
}

ulong[] getDivisors(ulong N) { // assumeSorted できる
	if(N == 0) return [];
	if(N == 1) return [1];
	ulong[] lower_part, upper_part;
	foreach(i; 1..N.to!real.sqrt.ceil.to!ulong) {
		if(N % i == 0) {
			lower_part ~= i;
			upper_part ~= N / i;
		}
	}
	upper_part.reverse();
	if(N.to!real.sqrt.to!ulong ^^ 2 == N) return lower_part ~ N.to!real.sqrt.to!ulong ~ upper_part;
	else return lower_part ~ upper_part;
}

// ===================================

import std.stdio;
import std.string;
import std.functional;
import std.algorithm;
import std.range;
import std.traits;
import std.math;
import std.container;
import std.bigint;
import std.numeric;
import std.conv;
import std.typecons;
import std.uni;
import std.ascii;
import std.bitmanip;
import core.bitop;

T readAs(T)() if (isBasicType!T) {
	return readln.chomp.to!T;
}
T readAs(T)() if (isArray!T) {
	return readln.split.to!T;
}

T[][] readMatrix(T)(uint height, uint width) if (!isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		res[i] = readAs!(T[]);
	}
	return res;
}

T[][] readMatrix(T)(uint height, uint width) if (isSomeChar!T) {
	auto res = new T[][](height, width);
	foreach(i; 0..height) {
		auto s = rs;
		foreach(j; 0..width) res[i][j] = s[j].to!T;
	}
	return res;
}

int ri() {
	return readAs!int;
}

long rl() {
	return readAs!long;
}

double rd() {
	return readAs!double;
}

string rs() {
	return readln.chomp;
}
0