結果

問題 No.219 巨大数の概算
ユーザー yukirinyukirin
提出日時 2016-01-29 16:33:28
言語 Go
(1.22.1)
結果
RE  
実行時間 -
コード長 1,376 bytes
コンパイル時間 11,479 ms
コンパイル使用メモリ 220,800 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-19 05:05:53
合計ジャッジ時間 15,740 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
6,816 KB
testcase_01 AC 29 ms
6,816 KB
testcase_02 AC 29 ms
6,940 KB
testcase_03 AC 29 ms
6,940 KB
testcase_04 RE -
testcase_05 AC 1 ms
6,940 KB
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 29 ms
6,944 KB
testcase_11 AC 28 ms
6,944 KB
testcase_12 AC 28 ms
6,944 KB
testcase_13 AC 29 ms
6,944 KB
testcase_14 AC 29 ms
6,944 KB
testcase_15 AC 29 ms
6,944 KB
testcase_16 AC 30 ms
6,940 KB
testcase_17 AC 30 ms
6,940 KB
testcase_18 AC 29 ms
6,944 KB
testcase_19 AC 29 ms
6,940 KB
testcase_20 AC 29 ms
6,940 KB
testcase_21 AC 30 ms
6,940 KB
testcase_22 AC 28 ms
6,940 KB
testcase_23 AC 29 ms
6,940 KB
testcase_24 AC 29 ms
6,944 KB
testcase_25 AC 30 ms
6,940 KB
testcase_26 AC 29 ms
6,940 KB
testcase_27 AC 28 ms
6,944 KB
testcase_28 RE -
testcase_29 AC 30 ms
6,940 KB
testcase_30 AC 29 ms
6,944 KB
testcase_31 AC 29 ms
6,940 KB
testcase_32 AC 30 ms
6,944 KB
testcase_33 AC 31 ms
6,944 KB
testcase_34 AC 29 ms
6,940 KB
testcase_35 AC 29 ms
6,944 KB
testcase_36 AC 29 ms
6,940 KB
testcase_37 AC 30 ms
6,944 KB
testcase_38 AC 29 ms
6,944 KB
testcase_39 AC 30 ms
6,944 KB
testcase_40 AC 29 ms
6,940 KB
testcase_41 AC 29 ms
6,944 KB
testcase_42 AC 29 ms
6,940 KB
testcase_43 AC 28 ms
6,940 KB
testcase_44 AC 28 ms
6,940 KB
testcase_45 AC 29 ms
6,940 KB
testcase_46 AC 30 ms
6,940 KB
testcase_47 AC 31 ms
6,940 KB
testcase_48 AC 28 ms
6,940 KB
testcase_49 AC 29 ms
6,944 KB
testcase_50 AC 29 ms
6,940 KB
testcase_51 AC 1 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	for i := 0; i < n; i++ {
		a, b := nextFloat(), nextFloat()
		r := b * math.Log10(a)
		e := math.Floor(r)
		s := fmt.Sprint(math.Pow(10, r-e))
		fmt.Printf("%s %s %d\n", s[0:1], s[2:3], int(e))
	}

}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(nextLine())
	return i
}

func nextInt64() int64 {
	i, _ := strconv.ParseInt(nextLine(), 10, 64)
	return i
}

func nextUint64() uint64 {
	i, _ := strconv.ParseUint(nextLine(), 10, 64)
	return i
}

func nextFloat() float64 {
	f, _ := strconv.ParseFloat(nextLine(), 64)
	return f
}

func readLine() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func factor(n uint64) []uint64 {
	if n <= 1 {
		return []uint64{n}
	}

	ps := make([]uint64, 0, 100)

	for i := uint64(2); i*i <= n; i++ {
		for n%i == 0 {
			n /= i
			ps = append(ps, i)
		}
	}
	if n > 1 {
		ps = append(ps, n)
	}
	return ps
}

func gcd(a, b uint64) uint64 {
	for ; b != 0; b, a = a%b, b {
	}
	return a
}

func lcm(a, b uint64) uint64 {
	return (a * b) / gcd(a, b)
}
0