結果

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

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
using namespace std;

#define Getsign(n) ((n > 0) - (n < 0))

typedef vector<int> Ivec;
typedef pair<int, int> Pos;

int main() {
	int n, m, x, y, a,b;
	scanf("%d %d %d %d", &n, &m, &x, &y);
	x %= 2 * m;
	y %= 2 * m;
	if (x == 0) x = m * 2;
	if (y == 0) y = m * 2;
	if ((x - m) >= 1) {
		a = m-(x-m)+1;
	}
	else a = x;

	if ((y - m) >= 1) {
		b = m - (y-m)+1;
	}
	else b = y;
	printf("%s\n", a == b ? "YES" : "NO");
	return 0;
}
0