Official

A - Three-Point Shot Editorial by QCFium


プログラミングの学習を始めたばかりで何から手をつけるべきかわからない方は、まずは practice contest の問題A「Welcome to AtCoder」をお試しください。言語ごとに解答例が掲載されています。

この問題では、\(\min(X, Y) + 3 > \max(X, Y)\) かを判定すればよいです。

解答例 (C++)

#include <stdio.h>
#include <algorithm>

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

int main() {
	int x = ri();
	int y = ri();
	puts(std::min(x, y) + 3 > std::max(x, y) ? "Yes" : "No");
	
	return 0;
}

解答例 (Python)


x, y = map(int, input().split())
print('Yes' if min(x, y) + 3 > max(x, y) else 'No')

posted:
last update: