2015弱校联盟(1) - E. Rectangle
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的更多相关文章
- 2015弱校联盟(2) - J. Usoperanto
J. Usoperanto Time Limit: 8000ms Memory Limit: 256000KB Usoperanto is an artificial spoken language ...
- 2015弱校联盟(1) - C. Censor
C. Censor Time Limit: 2000ms Memory Limit: 65536KB frog is now a editor to censor so-called sensitiv ...
- 2015弱校联盟(1) - B. Carries
B. Carries Time Limit: 1000ms Memory Limit: 65536KB frog has n integers a1,a2,-,an, and she wants to ...
- 2015弱校联盟(1) - I. Travel
I. Travel Time Limit: 3000ms Memory Limit: 65536KB The country frog lives in has n towns which are c ...
- 2015弱校联盟(1) -J. Right turn
J. Right turn Time Limit: 1000ms Memory Limit: 65536KB frog is trapped in a maze. The maze is infini ...
- 2015弱校联盟(1) -A. Easy Math
A. Easy Math Time Limit: 2000ms Memory Limit: 65536KB Given n integers a1,a2,-,an, check if the sum ...
- (2016弱校联盟十一专场10.3) D Parentheses
题目链接 把左括号看成A右括号看成B,推一下就行了.好久之前写的,推到最后发现是一个有规律的序列. #include <bits/stdc++.h> using namespace std ...
- (2016弱校联盟十一专场10.3) B.Help the Princess!
题目链接 宽搜一下就行. #include <iostream> #include<cstdio> #include<cstring> #include<qu ...
- (2016弱校联盟十一专场10.3) A.Best Matched Pair
题目链接 #include<cstdio> #include<cstring> #include<algorithm> #include<stack> ...
随机推荐
- ArcGIS JavaScript API异常之onExtentChange事件覆盖onClick事件
利用Esri官方提供的聚合类进行聚合,由于数据较多,为了加快速度,在聚合之前对当期范围进行判断,如果不在当前视图范围的,就不聚合了. 所以,由于Esri官方的类是监听了zoomEnd事件,如下代码 t ...
- NBUT比赛 方格规律递推题
题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=26901#problem/A 题意:有一个 2*n的格子里,你可以选择任意一个格 ...
- NGUI之Slider,最简单的方法做进度条。
既然标题是最简单的,那么很多东西就不需要我们自己做了,使用的是NGUI的示例,只针对初学者,接下来让我们来做一个最简单游戏设置里的声音控制. 1.导入NGUI: 2.找到NGUI的Menu示例Demo ...
- GROUP BY 與 Null 值
若群組資料行包含了 Null 值,該資料列將變成結果中的一個群組.若群組資料行內包含了多個 Null 值,Null 值將放入單一群組內.此行為定義於 SQL-2003 標準之中. Product 資料 ...
- Algorithm | Tree traversal
There are three types of depth-first traversal: pre-order,in-order, and post-order. For a binary tre ...
- <script>元素的位置
脚本元素会组织下载网页内容,浏览器可以同时下载多个组件,但一旦遇到一个外部脚本文本后,浏览器会停止进一步下载,知道这个脚本文件下载,解析并执行完毕.这会严重影响网页载入的总时间,特别是在网页在入时会发 ...
- 探索.git目录
.git目录 下面就开始进入.git目录,通过“ls”命令可以看到.git目录中的文件和子目录: 对于这些文件和目录,下面给出了一些基本的描述. hooks:这个目录存放一些shell脚本,可以设置特 ...
- LightOj 1197 - Help Hanzo(分段筛选法 求区间素数个数)
题目链接:http://lightoj.com/volume_showproblem.php?problem=1197 题意:给你两个数 a b,求区间 [a, b]内素数的个数, a and b ( ...
- idea使用心得(1)-快捷键用法
快捷键: Ctrl+F12,可以显示当前文件的结构,Alt+7,可在左侧生成固定框体控件,适合类复杂的情况 Ctrl+Alt+O,优化导入的类和包 Ctrl+X,删除行 删除光标所在的哪一行,对尤其是 ...
- 单身狗进化——求n!的位数
题目: 分析: 这道题目要求的是n!的位数,显然一种思路是先求出n!的值,假定为res,然后再计算res的位数,这种方法在n比较小时是可以的,如果res为int型,一旦n>16,res就会超出i ...