結果

問題 No.1571 All Your Cycles Are Same Lengths
ユーザー 👑 ygussanyygussany
提出日時 2021-06-27 13:17:15
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 470 bytes
コンパイル時間 241 ms
コンパイル使用メモリ 28,808 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-09-07 17:32:59
合計ジャッジ時間 2,299 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

int main()
{
	int i, j, k, q, Q, N, T, w[10] = {};
	scanf("%d", &Q);
	for (q = 1; q <= Q; q++) {
		scanf("%d %d", &N, &T);
		if (T % 2 != 0 && (T < N || (T >= N && (T - N) % 2 != 0))) {
			printf("No\n");
			continue;
		}
		if (T % 2 == 0) {
			k = 0;
			w[1] = T / 2;
		} else {
			k = 1;
			w[1] = (T - N) / 2;
		}
		for (i = 1; i <= N; i++) for (j = i + 1; j <= N; j++) printf("%d %d %d\n", i, j, k + w[i] + w[j]);
	}
	fflush(stdout);
	return 0;
}
0