/*
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. 【撸码caffe四】 solver.cpp&&sgd_solver.cpp

    caffe中solver的作用就是交替低啊用前向(forward)算法和后向(backward)算法来更新参数,从而最小化loss,实际上就是一种迭代的优化算法. solver.cpp中的Solver ...

  2. Java项目打包发布

    Java项目打包发布 如果只想发布为一个可执行的jar包,使用eclipse的Export功能就可以了 使用eclipse的Export功能,将项目中的所有package打包为一个pet.jar文件, ...

  3. 单向链表的归并排序——java实现

    在做Coursera上的Algorithms第三周测验练习的时候有一道链表随机排序问题,刚开始没有什么思路,就想着先把单向链表归并排序实现了,再此基础上进行随机排序的改造.于是就结合归并排序算法,实现 ...

  4. linux更换阿里云的源的shell脚本

    #!/bin/bash##########################################Function: update source#Usage: bash update_sour ...

  5. python的搜索路径与包(package)

    python的搜索路径其实是一个列表,它是指导入模块时,python会自动去找搜索这个列表当中的路径,如果路径中存在要导入的模块文件则导入成功,否则导入失败: >>> import ...

  6. facade 模式和gateway模式的区别

    原文:http://stackoverflow.com/questions/4422211/what-is-the-difference-between-facade-and-gateway-desi ...

  7. KindEditor文本编辑框的实现

    效果图: kindeditor 是一个插件 下载地址: https://files-cdn.cnblogs.com/files/lxnlxn/kindeditor.zip 解压后将其放在项目的js文件 ...

  8. 5.23Java各种对象(PO,BO,VO,DTO,POJO,DAO,Entity,JavaBean,JavaBeans)的区分

    作者:https://www.cnblogs.com/lyjin/p/6389349.html PO:持久对象(persistent object):---po就是在Object/Relation M ...

  9. Flutter GitLab 客户端

    F4Lab Flutter for GitLab. 欢迎参加一起完成

  10. c++ 虚函数,纯虚函数的本质区别

    转载博客:https://mp.weixin.qq.com/s?__biz=MzAxNzYzMTU0Ng==&mid=2651289202&idx=1&sn=431ffd1fa ...