結果

問題 No.2797 Square Tile
ユーザー shobonvip
提出日時 2024-06-27 00:09:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 100 ms / 2,000 ms
コード長 415 bytes
コンパイル時間 152 ms
コンパイル使用メモリ 82,460 KB
実行使用メモリ 78,488 KB
最終ジャッジ日時 2024-06-27 00:09:15
合計ジャッジ時間 3,415 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
a, b = map(int,input().split())
n = a * a + b * b
g = math.gcd(a, b)
x = 0
y = 0
a_list = []
b_list = []
mode = 0
for f  in range(g):
	for t in range(n//g*2):
		if mode == 0:
			a_list.append((x, y))
			x += a
			x %= n
		else:
			b_list.append((x, y))
			y += b
			y %= n
		mode ^= 1
	if mode == 0:
		x -= b
		x %= n
		y += a
		y %= n

for x, y in a_list:
	print(x, y)

for x, y in b_list:
	print(x, y)
0