結果
問題 |
No.3108 Luke or Bishop
|
ユーザー |
|
提出日時 | 2025-04-19 15:19:09 |
言語 | Go (1.23.4) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 506 bytes |
コンパイル時間 | 12,605 ms |
コンパイル使用メモリ | 250,684 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-04-19 15:19:23 |
合計ジャッジ時間 | 11,380 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 26 |
ソースコード
package main import ( "fmt" ) func getRook (gx int, gy int) int { if (gx == 0 || gy == 0) {return 1} return 2 } func getBishop (gx int, gy int) int { if ((gx + gy) % 2 != 0) {return 999} if (gx == 0 && gy == 0) {return 0} if (abs(gx) == abs(gy)) {return 1} return 2 } func abs(x int) int{ if(x < 0) {return -x} return x } func main(){ var gx, gy int fmt.Scan(&gx, &gy) rook := getRook(gx,gy) bishop := getBishop(gx,gy) ans := rook if(bishop < ans) {ans = bishop} fmt.Println(ans) }