結果

問題 No.1423 Triangle of Multiples
ユーザー customfolkcustomfolk
提出日時 2021-03-13 15:24:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 286 ms / 2,000 ms
コード長 1,212 bytes
コンパイル時間 168 ms
コンパイル使用メモリ 82,012 KB
実行使用メモリ 81,408 KB
最終ジャッジ日時 2024-04-23 06:52:39
合計ジャッジ時間 1,911 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
67,456 KB
testcase_01 AC 73 ms
67,968 KB
testcase_02 AC 286 ms
80,984 KB
testcase_03 AC 270 ms
81,280 KB
testcase_04 AC 272 ms
81,408 KB
権限があれば一括ダウンロードができます

ソースコード

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