結果

問題 No.1423 Triangle of Multiples
ユーザー customfolk
提出日時 2021-03-13 15:24:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 268 ms / 2,000 ms
コード長 1,212 bytes
コンパイル時間 229 ms
コンパイル使用メモリ 82,420 KB
実行使用メモリ 81,280 KB
最終ジャッジ日時 2024-10-15 06:41:30
合計ジャッジ時間 1,711 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict, deque, Counter
from heapq import heapify, heappop, heappush
import sys
import math
import random
import string
from copy import deepcopy
from itertools import combinations, permutations, product
from bisect import bisect_left, bisect_right

def input():
    return sys.stdin.readline().rstrip()
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]

sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7
INF = float('inf')
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]

#############
# Main Code #
#############

"""
sum(a, b, c) > 2 * max(a, b, c)
A, B, Cのmaxの元を照準にすると楽だが
Cを一番大きい整数とする

"""

prim = [7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101]
T = getN()
for _ in range(T):
    A, B, C = getNM()
    P = deepcopy(prim)
    # 互いに割り切れないようにする
    A *= 2
    B *= 3
    C *= 5

    while A >= B:
        B *= P.pop()
    while B >= C:
        C *= P.pop()
    print(((C - 1) // A) * A, ((C - 1) // B) * B, C)
0