/*
HDU4572 Bottles Arrangement
http://acm.hdu.edu.cn/showproblem.php?pid=4572
数论 找规律
题意:有m行n列和1-n的数各n个,将其填在m×n的格子里
要求同一列中的数各不相同,同一行中相邻两数的差的绝对值不超过1。
求每一行中值的和的最小值。 这道题很神奇,比赛的时候yy了一发交了上去,没想到真的A了
赛后看题解,发现大家各种yy,然而没有人和我的yy一样,
也许我脑洞过于新奇吧23333
首先这个值肯定比n*m要小,于是感觉应该是n*m-a的形式,有yy出
a与n有关
于是乎发现3对应1,5对应4,然后一眼看出这是(n/2)^2
真是敢写敢过
*/
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <iostream>
#include <map>
#include <set>
//#define test
using namespace std;
const int Nmax=;
int main()
{
#ifdef test
#endif
int n,m;
while(scanf("%d%d",&m,&n)==)
{
int ans=n*m;
n/=;
n*=n;
printf("%d\n",ans-n);
}
return ;
}

HDU4572 Bottles Arrangement的更多相关文章

  1. HDU 4572 Bottles Arrangement(找规律,仔细读题)

    题目 //找规律,123321123321123321…发现这样排列恰好可以错开 // 其中注意题中数据范围: M是行,N是列,3 <= N < 2×M //则猜测:m,m,m-1,m-1 ...

  2. 2013 ACM-ICPC长沙赛区全国邀请赛——Bottles Arrangement

    这题当时竟然没看啊…… 找规律:求和m+m+m-1+m-1+……前n项 ;}

  3. HDU 4572 Bottles Arrangement

    具体的证明:点击打开链接 我的想法: 要想保证题目所说 构造最小行的和,仅仅能是这样的情况 .....      m-3  m-2  m-1  m    |   m  m-1  m-2  m-3   ...

  4. CF 672C Recycling Bottles[最优次优 贪心]

    C. Recycling Bottles time limit per test 2 seconds memory limit per test 256 megabytes input standar ...

  5. codeforces A. Sereja and Bottles 解题报告

    题目链接:http://codeforces.com/problemset/problem/315/A 题目意思:有n个soda bottles,随后给出这n个soda bottles的信息.已知第 ...

  6. Codeforces Round #352 (Div. 2) C. Recycling Bottles 贪心

    C. Recycling Bottles   It was recycling day in Kekoland. To celebrate it Adil and Bera went to Centr ...

  7. [leetcode-526-Beautiful Arrangement]

    Suppose you have N integers from 1 to N. We define a beautiful arrangement as an array that is const ...

  8. zoj3777 Problem Arrangement

    The 11th Zhejiang Provincial Collegiate Programming Contest is coming! As a problem setter, Edward i ...

  9. ZOJ 3777-Problem Arrangement(状压DP)

    B - Problem Arrangement Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%lld & %l ...

随机推荐

  1. ArcGis空间参考的设置

    ArcGis10.0空间参考设置: 选择一个数据右击,进入属性properties 点击进入后则出现以下界面 双击进入后则出现以下界面 双击进入后出现如下界面,此时则可选择需要设置的空间参考 ArcG ...

  2. C#实现对数据库的备份还原(完全)

    C#实现对数据库的备份还原 ( 用SQL语句实现对数据库备份还原操作 备份SqlServer数据库: backup database 数据库名 to disk (备份文件存放路径+文件名).bak 还 ...

  3. bzoj 1093 [ ZJOI 2007 ] 最大半连通子图 —— 拓扑+DP

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1093 先缩点,然后就是找最长链,DP一下即可: 注意缩点后的重边!会导致重复计算答案. 代码 ...

  4. Colored Sticks(trie)

    http://poj.org/problem?id=2513 题意:给一些木棒,木棒两端图上颜色,将端点颜色相同的木棒连在一起,问是否能连成一条直线. 思路:将两端的颜色看成点,将木棒看成边,判断是否 ...

  5. F - Modular Exponentiation

    Problem description The following problem is well-known: given integers n and m, calculate 2n mod m, ...

  6. 导入不同业务数据通过Excel实现

    很多公司都用到了老系统移植到新系统,数据自然也需要迁移,这个解决方案之一就是使用Excel文件导入. 结合公司实现,然后简单写了个Demo. (PS:去找朋友本想着花几十分钟弄出来炫耀一波,结果花了三 ...

  7. java编程题(一)

    [程序1]    题目:古典问题:有一对兔子,从出生后第3个月起每个月都生一对兔子,小兔子长到第三个月后每个月又生一对兔子,假如兔子都不死,问每个月的兔子总数为多少? //这是一个菲波拉契数列问题 p ...

  8. End to End Sequence Labeling via Bi-directional LSTM CNNs CRF

    来看看今日头条首席科学家的论文: End-to-end Sequence Labeling via Bi-directional LSTM-CNNs-CRF 使用LSTM方法进行序列标注,完成大规模标 ...

  9. AS3.0+PHP写入mySQL

    php中$_POST变量是一个数组,用于收集来自method="post"的值,内容是有HTTP POST方法发送的变量名称和值. 从带有POST方法的表单发送的信息,对任何人都是 ...

  10. C# 聚合数据借口发短信的使用

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...