{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n #problem-body \u003e pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n }\n\u003c/style\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv id\u003d\"problem-body\"\u003e\n\t\u003cp\u003e\r\nHarry Potter has n mixtures in front of him, arranged in a row.\r\nEach mixture has one of 100 different colors (colors have numbers\r\nfrom 0 to 99).\r\n\u003c/p\u003e\u003cp\u003e\r\nHe wants to mix all these mixtures together. At each step, he is going\r\nto take two mixtures that stand next to each other and mix them together,\r\nand put the resulting mixture in their place.\r\n\r\n\u003c/p\u003e\u003cp\u003e\r\nWhen mixing two mixtures of colors a and b, the resulting mixture\r\nwill have the color (a+b) mod 100.\r\n\r\n\u003c/p\u003e\u003cp\u003e\r\nAlso, there will be some smoke in the process. The amount of smoke generated\r\nwhen mixing two mixtures of colors a and b is a*b.\r\n\u003c/p\u003e\u003cp\u003e\r\nFind out what is the minimum amount of smoke that Harry can get when\r\nmixing all the mixtures together.\r\n\r\n\r\n\u003c/p\u003e\u003ch3\u003eInput\u003c/h3\u003e\r\n\u003cp\u003e\r\nThere will be a number of test cases in the input.\r\n\u003c/p\u003e\u003cp\u003e\r\nThe first line of each test case will contain n, the number of mixtures,\r\n1 \u0026lt;\u003d n \u0026lt;\u003d 100.\r\n\u003c/p\u003e\u003cp\u003e\r\nThe second line will contain n integers between 0 and 99 - the\r\ninitial colors of the mixtures.\r\n\r\n\u003c/p\u003e\u003ch3\u003eOutput\u003c/h3\u003e\r\n\u003cp\u003e\r\nFor each test case, output the minimum amount of smoke.\r\n\r\n\r\n\u003c/p\u003e\u003ch3\u003eExample\u003c/h3\u003e\r\n\r\n\u003cdiv\u003e\u003ctable class\u003d\"vjudge_sample\"\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e2\r\n18 19\r\n3\r\n40 60 20\r\n\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e342\r\n2400\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003c/div\u003e\r\n\r\n\u003cp\u003e\r\nIn the second test case, there are two possibilities:\r\n\u003c/p\u003e\u003cul\u003e\r\n\u003cli\u003e first mix 40 and 60 (smoke: 2400), getting 0, then mix 0 and 20 (smoke: 0);\r\ntotal amount of smoke is 2400\r\n\u003c/li\u003e\u003cli\u003e first mix 60 and 20 (smoke: 1200), getting 80, then mix 40 and 80\r\n(smoke: 3200); total amount of smoke is 4400\r\n\u003c/li\u003e\u003c/ul\u003e\r\n\u003cp\u003e\r\nThe first scenario is a much better way to proceed.\r\n\r\n\n\u003c/p\u003e\u003c/div\u003e"}}]}