Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
这道题,用很暴力的方法都能0ms的。#include <stdio.h> int main() { int i, j, min, a, b, c; scanf("%d", &j); while (j--) { scanf("%d", &i); min = (int)0x7fffffff; for (a = 1; a <= 1000; a++) { if (a > i) break; for (b = 1; b <= 1000; b++) { if (a * b > i) break; for (c = 1; c <= 1000; c++) { if (a * b * c > i) break; if (a * b * c == i && 2 * (a * b + b * c + c * a) < min) min = 2 * (a * b + b * c + c * a); } } } printf("%d\n", min); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator