結果

問題 No.131 マンハッタン距離
コンテスト
ユーザー code-devo
提出日時 2016-03-03 13:54:11
言語 Go
(1.26.1)
コンパイル:
env GOCACHE=/tmp go build _filename_
実行:
./Main
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 384 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 13,815 ms
コンパイル使用メモリ 278,624 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-04-27 04:25:58
合計ジャッジ時間 15,050 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Scan(); x, _ := strconv.Atoi(sc.Text())
	sc.Scan(); y, _ := strconv.Atoi(sc.Text())
	sc.Scan(); d, _ := strconv.Atoi(sc.Text())

	n := d + 1
  if x < d {
    n -= d - x
  }
  if y < d {
    n -= d - y
  }
	if n < 0 {
		n = 0
	}
	fmt.Println(n)
}
0