結果

問題 No.250 atetubouのzetubou
ユーザー fmhrfmhr
提出日時 2015-07-29 16:57:47
言語 Go1.4
(1.4.2)
結果
AC  
実行時間 122 ms / 5,000 ms
コード長 858 bytes
コンパイル時間 377 ms
コンパイル使用メモリ 32,384 KB
実行使用メモリ 71,948 KB
最終ジャッジ日時 2024-05-03 20:32:36
合計ジャッジ時間 3,786 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 101 ms
71,940 KB
testcase_01 AC 86 ms
71,944 KB
testcase_02 AC 108 ms
71,944 KB
testcase_03 AC 113 ms
71,944 KB
testcase_04 AC 110 ms
71,940 KB
testcase_05 AC 110 ms
71,944 KB
testcase_06 AC 102 ms
71,944 KB
testcase_07 AC 95 ms
71,948 KB
testcase_08 AC 104 ms
71,940 KB
testcase_09 AC 122 ms
71,944 KB
testcase_10 AC 117 ms
71,940 KB
testcase_11 AC 105 ms
71,944 KB
testcase_12 AC 109 ms
71,948 KB
testcase_13 AC 97 ms
71,944 KB
testcase_14 AC 84 ms
71,948 KB
testcase_15 AC 115 ms
71,940 KB
testcase_16 AC 114 ms
71,948 KB
testcase_17 AC 111 ms
71,940 KB
testcase_18 AC 112 ms
71,944 KB
testcase_19 AC 111 ms
71,940 KB
testcase_20 AC 84 ms
71,944 KB
testcase_21 AC 86 ms
71,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

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

func main() {
	solve()
}

func solve() {
	pascal()
	Q := nextInt()
	var d, x, t int
	for i := 0; i < Q; i++ {
		d = nextInt()
		x = nextInt()
		t = nextInt()
		if p[d+x-1][x] <= t {
			fmt.Println("AC")
		} else {
			fmt.Println("ZETUBOU")
		}
	}
}

const S = 1000000000000000
const MAX = 3000

var p [MAX][MAX]int

func pascal() {
	p[0][0] = 1
	for i := 1; i < MAX; i++ {
		for j := 0; j < MAX; j++ {
			if j == 0 {
				p[i][j] = p[i-1][j]
			} else {
				if p[i-1][j-1]+p[i-1][j] < 0 {
					p[i][j] = p[i-1][j]
				} else {
					p[i][j] = p[i-1][j-1] + p[i-1][j]
				}
			}
		}
	}
	return
}

var s = bufio.NewScanner(os.Stdin)

func next() string {
	s.Split(bufio.ScanWords)
	s.Scan()
	return s.Text()
}

func nextInt() int {
	i, e := strconv.Atoi(next())
	if e != nil {
		panic(e)
	}
	return i
}
0