結果

問題 No.73 helloworld
ユーザー yukirinyukirin
提出日時 2016-02-25 15:38:19
言語 Go
(1.22.1)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,001 bytes
コンパイル時間 15,140 ms
コンパイル使用メモリ 200,152 KB
実行使用メモリ 8,712 KB
最終ジャッジ日時 2023-08-22 21:39:05
合計ジャッジ時間 22,121 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
7,800 KB
testcase_01 AC 1 ms
4,352 KB
testcase_02 AC 1 ms
4,356 KB
testcase_03 AC 1 ms
4,360 KB
testcase_04 AC 1 ms
4,356 KB
testcase_05 AC 1 ms
4,352 KB
testcase_06 AC 2 ms
4,356 KB
testcase_07 AC 1 ms
4,352 KB
testcase_08 AC 2 ms
4,356 KB
testcase_09 AC 1 ms
4,356 KB
testcase_10 AC 1 ms
4,352 KB
testcase_11 AC 1 ms
4,356 KB
testcase_12 TLE -
testcase_13 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	alpha := make([]int, 26)
	for i := range alpha {
		alpha[i] = nextInt()
	}

	t := alpha['h'-'a'] * alpha['e'-'a'] * alpha['w'-'a'] * alpha['r'-'a'] * alpha['d'-'a']

	o := alpha['o'-'a']
	t *= (o / 2) * (o - o/2)

	l := alpha['l'-'a']
	n := 2*(l/3) + l%3
	t *= int(NCR(uint64(n), 2)) * (l - n)
	fmt.Println(t)

}

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 NCR(n, r uint64) uint64 {
	k := r
	if k > n/2 {
		k = n - r
	}

	ret := uint64(1)
	for i := uint64(1); i <= k; i++ {
		ret *= n - i + 1
		ret /= i
	}
	return ret
}
0