Codeforces round #266 (Div. 2) B. Wonder room

Source: Internet
Author: User

tag: Io OS AR for data art Div SP CTI

The start of the new academic year brought about the problem of accommodation students into dormitories. One of such dormitories hasA? ×?BSquare meter wonder room. The caretaker wants to accommodate exactlyNStudents there. But the law says that there must be at least 6 square meters per student in a room (that is, the roomNStudents must have the area of at least6NSquare meters). The caretaker can enlarge any (possibly both) side of the room by an arbitrary positive integer of meters. Help him change the room so as allNStudents cocould live in it and the total area of the room was small as possible.

Input

The first line contains three space-separated IntegersN,AAndB(1? ≤?N,?A,?B? ≤? 109)-The number of students and the sizes of the room.

Output

Print three IntegersS,A1AndB1(A? ≤?A1;B? ≤?B1)-The final area of the room and Its sizes. If there are multiple optimal solutions, print any of them.

Sample test (s) Input
 
3 3 5
Output
 
183 6
Input
2 4 4
Output
 
164 4. Arrange the dormitory size. Each student must have at least 6 m² of the size. Ask n students. If the original dormitory is a * B, the idea of the new dormitory size after expansion is as follows: search, at first 10 ^ 9 cannot pass, but after we enumerate the size of one side A, for the other side B, if we add a condition where we set a <= B at first, then when we enumerate to a> B, it means symmetric conditions will occur, so that the data size is half the size.
# Include <iostream> # include <cstdio> # include <cstring> # include <algorithm> typedef long ll; using namespace STD; int main () {ll N,, b; CIN> N> A> B; N * = 6; int flag = 0; If (A> B) {// initially set X <yswap (, b); flag = 1;} ll ans = 2000000000000000000ll; ll Nx =-1, NY =-1; for (ll I = 1; I <= N; I ++) {ll x = I; ll y = (n + X-1)/X; If (x> Y) // The symmetric break is displayed; if (x <A) x = A; If (Y <B) y = B; If (x * Y <ans) {Nx = x; ny = y; ans = x * y ;}}if (FLAG) Swap (NX, NY); cout <ans <Endl; cout <NX <"" <ny <Endl; return 0 ;}


Codeforces round #266 (Div. 2) B. Wonder room

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.