[BOJ 6911] Concentration Cards

View as PDF

Submit solution

Points: 1
Time limit: 1.0s
Memory limit: 128M

Problem types
Allowed languages
Assembly, Awk, C, C++, Java, Pascal, Perl, Python, Sed, Text

Stan has a deck of $N$ Concentration Cards. He wants to lay the cards edge-to-edge to form a filled rectangle with minimal perimeter. Each card is a rectangle with dimensions $W$ mm by $H$ mm.</p>

Figure 1: Concentration Cards

입력 형식

The first line of input contains $C$, the number of test cases. For each case there is an additional line containing $N$, $W$, $H$, each a positive integer not exceeding $1000$.

출력 형식

Your program should produce one line of output per case, giving the minimal perimeter.

예제 입력

3
3 300 400
4 400 300
7 300 400

예제 출력

2600
2800
3800

Comments

There are no comments at the moment.