結果

問題 No.1423 Triangle of Multiples
コンテスト
ユーザー customfolk
提出日時 2021-03-13 15:24:09
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 176 ms / 2,000 ms
+ 154µs
コード長 1,212 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 79 ms
コンパイル使用メモリ 80,768 KB
実行使用メモリ 88,448 KB
最終ジャッジ日時 2026-09-17 23:02:39
合計ジャッジ時間 2,174 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 4
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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