結果
問題 | No.677 10^Nの約数 |
ユーザー | aru aru |
提出日時 | 2020-10-11 20:28:39 |
言語 | Go (1.22.1) |
結果 |
AC
|
実行時間 | 1,110 ms / 2,000 ms |
コード長 | 10,180 bytes |
コンパイル時間 | 13,567 ms |
コンパイル使用メモリ | 241,660 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-20 17:36:14 |
合計ジャッジ時間 | 15,043 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
5,248 KB |
testcase_01 | AC | 1 ms
5,376 KB |
testcase_02 | AC | 2 ms
5,376 KB |
testcase_03 | AC | 1 ms
5,376 KB |
testcase_04 | AC | 1 ms
5,376 KB |
testcase_05 | AC | 1 ms
5,376 KB |
testcase_06 | AC | 1 ms
5,376 KB |
testcase_07 | AC | 1 ms
5,376 KB |
testcase_08 | AC | 1 ms
5,376 KB |
testcase_09 | AC | 2 ms
5,376 KB |
testcase_10 | AC | 2 ms
5,376 KB |
testcase_11 | AC | 5 ms
5,376 KB |
testcase_12 | AC | 13 ms
5,376 KB |
testcase_13 | AC | 38 ms
5,376 KB |
testcase_14 | AC | 116 ms
5,376 KB |
testcase_15 | AC | 355 ms
5,376 KB |
testcase_16 | AC | 1,110 ms
5,376 KB |
testcase_17 | AC | 2 ms
5,376 KB |
testcase_18 | AC | 1 ms
5,376 KB |
ソースコード
package main import ( "bufio" "fmt" "os" "sort" "strconv" ) var sc = bufio.NewScanner(os.Stdin) var wr = bufio.NewWriter(os.Stdout) func out(x ...interface{}) { fmt.Fprintln(wr, x...) } func getI() int { sc.Scan() i, e := strconv.Atoi(sc.Text()) if e != nil { panic(e) } return i } func getF() float64 { sc.Scan() i, e := strconv.ParseFloat(sc.Text(), 64) if e != nil { panic(e) } return i } func getInts(N int) []int { ret := make([]int, N) for i := 0; i < N; i++ { ret[i] = getI() } return ret } func getS() string { sc.Scan() return sc.Text() } // min, max, asub, absなど基本関数 func max(a, b int) int { if a > b { return a } return b } func min(a, b int) int { if a < b { return a } return b } func asub(a, b int) int { if a > b { return a - b } return b - a } func abs(a int) int { if a >= 0 { return a } return -a } func lowerBound(a []int, x int) int { idx := sort.Search(len(a), func(i int) bool { return a[i] >= x }) return idx } func upperBound(a []int, x int) int { idx := sort.Search(len(a), func(i int) bool { return a[i] > x }) return idx } func f(n int) []int { ret := make([]int, 0) for i := 1; i*i <= n; i++ { if n%i == 0 { ret = append(ret, i) if n/i != i { ret = append(ret, n/i) } } } sort.Ints(ret) return ret } func main() { defer wr.Flush() sc.Split(bufio.ScanWords) sc.Buffer([]byte{}, 1000000) // this template is new version. // use getI(), getS(), getInts(), getF() N := getI() x := 1 for i := 0; i < N; i++ { x *= 10 } var ret []int if N == 17 { ret = ans17 } else if N == 18 { ret = ans18 } else { ret = f(x) } for _, e := range ret { out(e) } } var ans18 = []int{ // 18 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, } var ans17 = []int{ // 17 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, }