結果
問題 | No.131 マンハッタン距離 |
ユーザー |
|
提出日時 | 2016-01-25 08:53:19 |
言語 | Go (1.23.4) |
結果 |
AC
|
実行時間 | 1 ms / 5,000 ms |
コード長 | 440 bytes |
コンパイル時間 | 11,963 ms |
コンパイル使用メモリ | 222,456 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-10 21:03:35 |
合計ジャッジ時間 | 12,894 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 |
ソースコード
package mainimport ("bufio""fmt""os""strconv")type Point struct {x, y int}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())if x > d {x = d}if y > d {y = d}n := (x + y) - d + 1if n > d + 1 {n = d + 1}if n < 0 {n = 0}fmt.Println(n)}