307159: CF1311D. Three Integers
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Three Integers
题意翻译
## 题目描述 题目给出三个整数 $a \le b \le c$。 在一次操作中,你可以给这三个数中任意一个数 $+1$ 或 $-1$。你可以用同一个数字做这样的操作任意次。但你要保证,变换过后的数,是一个正数。 你想要用最小操作步数使得三个整数 $A \le B \le C$ 能够符合:$B$ 能被 $A$ 整除, $C$ 能被 $B$ 整除。 你需要回答 $t$ 组询问。 ## 输入格式 第一行,一个整数 $t$ $(1 \le t \le 100)$,询问的次数。 以下 $t$ 行描述了一些询问。每个询问占一行,其中有三个整数 $a,b,c$ $(1 \le a \le b \le c \le 10^4)$,用空格隔开。 ## 输出格式 对于每组询问,输出答案两行。 在第一行输出 $res$,表示操作次数的最小值,使得三个整数 $A \le B \le C$ 能够符合:$B$ 能被 $A$ 整除, $C$ 能被 $B$ 整除。 在第二行,输出任意一个符合条件的三元组 $(a,b,c)$。题目描述
You are given three integers $ a \le b \le c $ . In one move, you can add $ +1 $ or $ -1 $ to any of these integers (i.e. increase or decrease any number by one). You can perform such operation any (possibly, zero) number of times, you can even perform this operation several times with one number. Note that you cannot make non-positive numbers using such operations. You have to perform the minimum number of such operations in order to obtain three integers $ A \le B \le C $ such that $ B $ is divisible by $ A $ and $ C $ is divisible by $ B $ . You have to answer $ t $ independent test cases.输入输出格式
输入格式
The first line of the input contains one integer $ t $ ( $ 1 \le t \le 100 $ ) — the number of test cases. The next $ t $ lines describe test cases. Each test case is given on a separate line as three space-separated integers $ a, b $ and $ c $ ( $ 1 \le a \le b \le c \le 10^4 $ ).
输出格式
For each test case, print the answer. In the first line print $ res $ — the minimum number of operations you have to perform to obtain three integers $ A \le B \le C $ such that $ B $ is divisible by $ A $ and $ C $ is divisible by $ B $ . On the second line print any suitable triple $ A, B $ and $ C $ .
输入输出样例
输入样例 #1
8
1 2 3
123 321 456
5 10 15
15 18 21
100 100 101
1 22 29
3 19 38
6 30 46
输出样例 #1
1
1 1 3
102
114 228 456
4
4 8 16
6
18 18 18
1
100 100 100
7
1 22 22
2
1 19 38
8
6 24 48