結果

問題 No.396 クラス替え
ユーザー warashiwarashi
提出日時 2016-07-15 22:45:22
言語 Go
(1.23.4)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 325 bytes
コンパイル時間 11,856 ms
コンパイル使用メモリ 230,920 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-17 10:46:23
合計ジャッジ時間 12,364 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import "fmt"

func class(M, x int) int {
	if x == 0 {
		return 1
	} else if x <= M {
		return x
	} else {
		return 2*M + 1 - x
	}
}
func main() {
	var N, M, X, Y int
	fmt.Scan(&N, &M, &X, &Y)

	x := class(M, X%(2*M))
	y := class(M, Y%(2*M))

	if x == y {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}
0