标签归档:枚举

Codeforces Round#274 Div.2

A. Expression

Petya studies in a school and he adores Maths. His class has been studying arithmetic expressions. On the last class the teacher wrote three positive integers a, b, c on the blackboard. The task was to insert signs of operations '+' and '*', and probably brackets between the numbers so that the value of the resulting expression is as large as possible. Let's consider an example: assume that the teacher wrote numbers 1, 2 and 3 on the blackboard. Here are some ways of placing signs and brackets:

  • 1+2*3=7
  • 1*(2+3)=5
  • 1*2*3=6
  • (1+2)*3=9

Note that you can insert operation signs only between a and b, and between b and c, that is, you cannot swap integers. For instance, in the given sample you cannot get expression (1+3)*2.

It's easy to see that the maximum value that you can obtain is 9.

Your task is: given a, b and c print the maximum value that you can get. 继续阅读

[bzoj 1047][HAOI2007]理想的正方形

Description

  有一个a*b的整数组成的矩阵,现请你从中找出一个n*n的正方形区域,使得该区域所有数中的最大值和最小值的差最小。

Input

  第一行为3个整数,分别表示a,b,n的值第二行至第a+1行每行为b个非负整数,表示矩阵中相应位置上的数。每行相邻两数之间用一空格分隔。100%的数据2<=a,b<=1000,n<=a,n<=b,n<=100

继续阅读

CodeForces Round#359 Div.2 Solution

这场比赛现场我只做出了两题(果然还是太弱)

太久没碰代码导致码力下降以至于C题这种简单题不会做

D题知识迁移能力太弱,明明知道重心合并一定在路上= =却不敢写

QQ图片20160623113150下次在努力。。

继续阅读