E. Rectangle

Time Limit: 1000ms

Memory Limit: 65536KB

64-bit integer IO format: %lld Java class name: Main

Submit Status

frog has a piece of paper divided into n rows and m columns. Today, she would like to draw a rectangle whose perimeter is not greater than k.

There are 8 (out of 9) ways when n=m=2,k=6

Find the number of ways of drawing.

Input

The input consists of multiple tests. For each test:

The first line contains 3 integer n,m,k (1≤n,m≤5⋅104,0≤k≤109).

Output

For each test, write 1 integer which denotes the number of ways of drawing.

Sample Input

2 2 6

1 1 0

50000 50000 1000000000

Sample Output

8

0

156256250062500000

有技巧的暴力,枚举一条边,计算另外一条边的情况

#include <bits/stdc++.h>
#define LL long long
#define fread() freopen("in.in","r",stdin)
#define fwrite() freopen("out.out","w",stdout) using namespace std; int main()
{
LL n,m,k;
while(cin>>n>>m>>k)
{
LL ans=0;
k/=2;
for(int i=1;i<=n&&k-i>0;i++)
{
LL a=(n-i+1);
LL b=min(k-i,m);
LL c=(m+(m-b+1))*b/2;
ans+=(a*c);
}
cout<<ans<<endl;
}
return 0;
}

2015弱校联盟(1) - E. Rectangle的更多相关文章

  1. 2015弱校联盟(2) - J. Usoperanto

    J. Usoperanto Time Limit: 8000ms Memory Limit: 256000KB Usoperanto is an artificial spoken language ...

  2. 2015弱校联盟(1) - C. Censor

    C. Censor Time Limit: 2000ms Memory Limit: 65536KB frog is now a editor to censor so-called sensitiv ...

  3. 2015弱校联盟(1) - B. Carries

    B. Carries Time Limit: 1000ms Memory Limit: 65536KB frog has n integers a1,a2,-,an, and she wants to ...

  4. 2015弱校联盟(1) - I. Travel

    I. Travel Time Limit: 3000ms Memory Limit: 65536KB The country frog lives in has n towns which are c ...

  5. 2015弱校联盟(1) -J. Right turn

    J. Right turn Time Limit: 1000ms Memory Limit: 65536KB frog is trapped in a maze. The maze is infini ...

  6. 2015弱校联盟(1) -A. Easy Math

    A. Easy Math Time Limit: 2000ms Memory Limit: 65536KB Given n integers a1,a2,-,an, check if the sum ...

  7. (2016弱校联盟十一专场10.3) D Parentheses

    题目链接 把左括号看成A右括号看成B,推一下就行了.好久之前写的,推到最后发现是一个有规律的序列. #include <bits/stdc++.h> using namespace std ...

  8. (2016弱校联盟十一专场10.3) B.Help the Princess!

    题目链接 宽搜一下就行. #include <iostream> #include<cstdio> #include<cstring> #include<qu ...

  9. (2016弱校联盟十一专场10.3) A.Best Matched Pair

    题目链接 #include<cstdio> #include<cstring> #include<algorithm> #include<stack> ...

随机推荐

  1. vs2013打开 2010项目时: 请确认 <Import> 声明中的路径正确,且磁盘上存在该文件

    错误原因:原来2010项目中使用的路径是 v11.0,但是我的 C:\Program Files (x86)\MSBuild\12.0\ 是 12.0,所以该成 12.0 解决办法:将项目文件(.cs ...

  2. JAVA6开发WebService (二)——JAX-WS例子

    转载自http://wuhongyu.iteye.com/blog/807836 上一篇写了个最简单的小例子,只是为了说明JAVA6开发Web Service很方便,这一篇稍微深入一点,写个稍微有点代 ...

  3. 学习Jquery

    早就听说了Jquery的大名,一直没有细心的学习一下,通过阅读收集的一些资料,感觉Jquery真的很强大.决定开始自己的学习Jquery之旅.在这里不是为大家讲解Jquery(深知水平有限),只是将自 ...

  4. 2016HUAS暑假集训题1 A-士兵队列训练问题

    A - 士兵队列训练问题 Description 某部队进行新兵队列训练,将新兵从一开始按顺序依次编号,并排成一行横队,训练的规则如下:从头开始一至二报数,凡报到二的出列,剩下的向小序号方向靠拢,再从 ...

  5. zju(1)嵌入式开发环境构建

    1. 实验目的 搭建嵌入式开发环境,安装ubntu,编译交叉工具链,安装配置tftp,nfs.用makefile 编译几个文件,在实验台上运行. 2. 实验内容 1) 安装ubuntu12.04 2) ...

  6. javascript遍历数组最优写法

    var arr = [];//这样定义的数组,是null,等待开辟空间 var arr = new Array();//不建议使用,会占用一块内存空间 var i=0,len=arr.length; ...

  7. 让dwz 在td里显示图片

    让dwz 在td里显示图片 <!@{foreach from = $list item = element}@> <tr target="gid" rel=&qu ...

  8. IOS第一天多线程-05GCD队列的使用

    ************** // // HMViewController.m // 08-GCD02-队列的使用(了解) // // Created by apple on 14-9-15. // ...

  9. C#抽象类、抽象方法、虚方法

    定义抽象类和抽象方法: abstract 抽象类特点: 1.不能初始化的类被叫做抽象类,它们只提供部分实现,但是另一个类可以继承它并且能创建它们的实例 2.一个抽象类可以包含抽象和非抽象方法,当一个类 ...

  10. centos7 挂载数据盘

    centos 挂载数据盘1.运行 fdisk -l 命令查看数据盘.注意:在没有分区和格式化数据盘之前,使用 df -h 命令是无法看到数据盘的. 如果执行了 fdisk -l 命令后,没有发现 /d ...