結果
| 問題 |
No.523 LED
|
| コンテスト | |
| ユーザー |
c-yan
|
| 提出日時 | 2021-02-01 04:26:08 |
| 言語 | Go (1.23.4) |
| 結果 |
AC
|
| 実行時間 | 96 ms / 2,000 ms |
| コード長 | 1,041 bytes |
| コンパイル時間 | 9,770 ms |
| コンパイル使用メモリ | 227,844 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-29 22:46:25 |
| 合計ジャッジ時間 | 11,167 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 |
ソースコード
package main
import (
"bufio"
"fmt"
"os"
"strconv"
)
const (
m = 1000000007
)
func mpow(x, y int) int {
result := 1
for y != 0 {
if y&1 == 1 {
result *= x
result %= m
}
x *= x
x %= m
y >>= 1
}
return result
}
func main() {
defer flush()
N := readInt()
result := 1
for i := 1; i < N*2+1; i++ {
result *= i
result %= m
}
result *= mpow(mpow(2, N), m-2)
result %= m
println(result)
}
const (
ioBufferSize = 1 * 1024 * 1024 // 1 MB
)
var stdinScanner = func() *bufio.Scanner {
result := bufio.NewScanner(os.Stdin)
result.Buffer(make([]byte, ioBufferSize), ioBufferSize)
result.Split(bufio.ScanWords)
return result
}()
func readString() string {
stdinScanner.Scan()
return stdinScanner.Text()
}
func readInt() int {
result, err := strconv.Atoi(readString())
if err != nil {
panic(err)
}
return result
}
var stdoutWriter = bufio.NewWriter(os.Stdout)
func flush() {
stdoutWriter.Flush()
}
func println(args ...interface{}) (int, error) {
return fmt.Fprintln(stdoutWriter, args...)
}
c-yan