結果

問題 No.84 悪の算盤
ユーザー yuki2006yuki2006
提出日時 2015-03-07 09:13:29
言語 Go1.4
(1.4.2)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 579 bytes
コンパイル時間 1,842 ms
コンパイル使用メモリ 33,876 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-03 12:05:13
合計ジャッジ時間 2,546 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

package main

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

// 参考 http://yukicoder.me/submissions/9329
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
}
func nextLong() int64 {
	i, e := strconv.ParseInt(next(), 10, 64)
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	R := nextLong()
	C := nextLong()
	ans := int64(0)
	n := R * C

	if R == C {
		ans = n/4+n%4
	}else {
		ans = n/2+n%2
	}
	fmt.Println(ans - 1)
}

0