結果

問題 No.396 クラス替え
ユーザー FF256grhy
提出日時 2016-07-15 22:37:53
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 237 bytes
コンパイル時間 112 ms
コンパイル使用メモリ 22,400 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-17 10:44:28
合計ジャッジ時間 792 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:12:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |         scanf("%d%d%d%d", &n, &m, &x, &y);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int n, m;

int f(int x) {
	int z = x % (2 * m);
	return z < m ? z : (m - 1) - z % m;
}

int main () {
	int x, y;
	scanf("%d%d%d%d", &n, &m, &x, &y);
	
	printf("%s\n", f(x-1) == f(y-1) ? "YES" : "NO" );
	
	return 0;
}
0