SCU 4440 分类: ACM 2015-06-20 23:58 16人阅读 评论(0) 收藏
2015-06-20 23:58
429 查看
SCU - 4440
Rectangle
Submit
Status
Description
There are 8 (out of 9 ) ways when n = m = 2 , k = 6
Find the number of ways of drawing.
The first line contains 3 integer n , m , k ( 1 ≤ n , m ≤ 5 ⋅ 10 4 , 0 ≤ k ≤ 10 9 ).
#include<math.h>
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
using namespace std;
#define N 115
long long n,m,k,sum;
int main()
{
while(~scanf("%lld%lld%lld",&n,&m,&k))
{
sum=0;
for(long long i=1;k-2*i>=2&&i<=n;i++)
{
long long mi=min((k-2*i)/2,m);
long long x=n-i+1,y=m+1;
sum+=x*(mi*y-(1+mi)*mi/2);
}
printf("%lld\n",sum);
}
return 0;
}
//freopen("1.txt", "r", stdin);
//freopen("2.txt", "w", stdout);
//**************************************
省赛中的一题,暴力枚举,没想出来真是不应该,想出来就铜牌了
[/code]
Rectangle
Time Limit: Unknown | Memory Limit: Unknown | 64bit IO Format: %lld & %llu |
Status
Description
Rectangle
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 ⋅ 10 4 , 0 ≤ k ≤ 10 9 ).
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 1562562500625000000#include<queue>
#include<math.h>
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
using namespace std;
#define N 115
long long n,m,k,sum;
int main()
{
while(~scanf("%lld%lld%lld",&n,&m,&k))
{
sum=0;
for(long long i=1;k-2*i>=2&&i<=n;i++)
{
long long mi=min((k-2*i)/2,m);
long long x=n-i+1,y=m+1;
sum+=x*(mi*y-(1+mi)*mi/2);
}
printf("%lld\n",sum);
}
return 0;
}
//freopen("1.txt", "r", stdin);
//freopen("2.txt", "w", stdout);
//**************************************
省赛中的一题,暴力枚举,没想出来真是不应该,想出来就铜牌了
[/code]
相关文章推荐
- java笔记25 File类、递归、Properties
- iOS图片拉伸技巧
- 2015第25周六
- 读后感
- 小白的柳州麻将黑科技.Part1 = 你不知道的门清
- Cygwin中使用ncurses库
- VS高亮显示无扩展名源码文件
- 为什么基类中的析构函数要声明为虚析构函数?
- Fragment管理的工具类
- 最大自序和问题
- java基础—IO流——将一些字符写入到指定硬盘上的目录中去:
- 最大自序和问题
- python3.3:文本文件读取、处理及保存。小练习
- fatal error C1189: #error : missing -D__STDC_CONSTANT_MACROS / #define __STDC_CONSTANT_MACROS
- Struts2获取Web容器资源的方式 访问request,session
- 2015062010 - 英雄
- 运行及总结
- 《梦断代码》第一篇总结
- 课本最后一章及博客读后感
- 15HD_OJ——FatMouse's Speed