結果

問題 No.131 マンハッタン距離
ユーザー code-devo
提出日時 2016-03-03 13:54:11
言語 Go
(1.23.4)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 384 bytes
コンパイル時間 11,875 ms
コンパイル使用メモリ 228,336 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-10 23:26:57
合計ジャッジ時間 11,957 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

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