結果

問題 No.1801 Segment Game
ユーザー ytqm3
提出日時 2022-04-08 19:01:12
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 59 ms / 2,000 ms
コード長 399 bytes
コンパイル時間 1,784 ms
コンパイル使用メモリ 191,416 KB
最終ジャッジ日時 2025-01-28 15:45:02
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 10
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘void solve()’:
main.cpp:16:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   16 |         scanf("%lld %lld %lld", &H, &W, &D);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp: In function ‘int main()’:
main.cpp:25:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   25 |         scanf("%d", &T);
      |         ~~~~~^~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using i64 = long long;

bool check(i64 H, i64 W, i64 D) {
	if(H % 2 == 0) {
		return W <= D;
	}
	else {
		return W * W + 1 <= D * D;
	}
}

void solve() {
	i64 H,W,D;
	scanf("%lld %lld %lld", &H, &W, &D);
	bool f = 0;
	f |= check(H, W, D);
	f |= check(W, H, D);
	puts(f ? "N" : "S");
}

int main() {
	int T;
	scanf("%d", &T);
	while(T--){
		solve();
	}
}
0