Question
Refer to others' blogs, Baidu's blogs
# Include <iostream> # include <string> # include <stdio. h> # include <string. h> # include <math. h ># include <algorithm> using namespace STD; // brute force // A between ≤ 1_a1; B between ≤ 1_b1int main () {_ int64 N, A, B; scanf ("% i64d % i64d % i64d", & N, & A, & B); If (N * 6 <= a * B) printf ("% i64d \ n % i64d % i64d \ n", a * B, a, B); else {_ int 64mm = N * 6, x =, y = B, mmm = 0; _ int64 M = (_ int64) SQRT (MM) + 1; for (_ int64 I = A; I <= m; I ++) {_ int64 YY = mm/I + (MM % I! = 0); If (yy * I >=mm & YY> = B) {If (! Mmm) Mmm = I * YY, x = I, y = YY; else if (yy * I <MMM) Mmm = YY * I, x = I, y = YY ;}for (_ int64 I = B; I <= m; I ++) {_ int64 xx = mm/I + (MM % I! = 0); If (XX * I >=mm & XX> = A) {If (! Mmm) Mmm = I * XX, y = I, x = xx; else if (XX * I <MMM) Mmm = XX * I, y = I, X = XX ;}} printf ("% i64d \ n % i64d % i64d \ n", mmm, x, y) ;}return 0 ;}
View code
Codeforces 466b wonder room (thinking, brute force)