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.
 
 
 
枚举长度  然后算出宽度的取值范围  对宽带再进行求合
 
  1. #include <cstdio>
  2. #include <cstring>
  3. #include <queue>
  4. #include <cmath>
  5. #include <algorithm>
  6. #include <set>
  7. #include <iostream>
  8. #include <map>
  9. #include <stack>
  10. #include <string>
  11. #include <vector>
  12. #define pi acos(-1.0)
  13. #define eps 1e-6
  14. #define fi first
  15. #define se second
  16. #define lson l,m,rt<<1
  17. #define rson m+1,r,rt<<1|1
  18. #define bug printf("******\n")
  19. #define mem(a,b) memset(a,b,sizeof(a))
  20. #define fuck(x) cout<<"["<<x<<"]"<<endl
  21. #define f(a) a*a
  22. #define sf(n) scanf("%d", &n)
  23. #define sff(a,b) scanf("%d %d", &a, &b)
  24. #define sfff(a,b,c) scanf("%d %d %d", &a, &b, &c)
  25. #define pf printf
  26. #define FRE(i,a,b) for(i = a; i <= b; i++)
  27. #define FREE(i,a,b) for(i = a; i >= b; i--)
  28. #define FRL(i,a,b) for(i = a; i < b; i++)
  29. #define FRLL(i,a,b) for(i = a; i > b; i--)
  30. #define FIN freopen("DATA.txt","r",stdin)
  31. #define lowbit(x) x&-x
  32. #pragma comment (linker,"/STACK:102400000,102400000")
  33.  
  34. using namespace std;
  35. const int maxn = 1e5 + ;
  36. typedef long long LL;
  37. LL n,m,k;
  38. int main() {
  39. while(~sfff(n,m,k)){
  40. k=k/;
  41. LL ans=;
  42. for (int i= ;i<=n ;i++) {
  43. if (k-i<=) break;
  44. LL a=(n-i+);
  45. LL b=min(k-i,m);
  46. LL c=(m+(m-b+))*b/;
  47. ans+=a*c;
  48. }
  49. printf("%lld\n",ans);
  50. }
  51. return ;
  52. }

Rectangle 暴力枚举大法的更多相关文章

  1. 区间Dp 暴力枚举+动态规划 Hdu1081

    F - 最大子矩形 Time Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64u Submit Status Des ...

  2. UVA 10012 How Big Is It?(暴力枚举)

      How Big Is It?  Ian's going to California, and he has to pack his things, including his collection ...

  3. CodeForces 742B Arpa’s obvious problem and Mehrdad’s terrible solution (暴力枚举)

    题意:求定 n 个数,求有多少对数满足,ai^bi = x. 析:暴力枚举就行,n的复杂度. 代码如下: #pragma comment(linker, "/STACK:1024000000 ...

  4. 2014牡丹江网络赛ZOJPretty Poem(暴力枚举)

    /* 将给定的一个字符串分解成ABABA 或者 ABABCAB的形式! 思路:暴力枚举A, B, C串! */ 1 #include<iostream> #include<cstri ...

  5. HNU 12886 Cracking the Safe(暴力枚举)

    题目链接:http://acm.hnu.cn/online/?action=problem&type=show&id=12886&courseid=274 解题报告:输入4个数 ...

  6. 51nod 1116 K进制下的大数 (暴力枚举)

    题目链接 题意:中文题. 题解:暴力枚举. #include <iostream> #include <cstring> using namespace std; ; ; ch ...

  7. Codeforces Round #349 (Div. 1) B. World Tour 最短路+暴力枚举

    题目链接: http://www.codeforces.com/contest/666/problem/B 题意: 给你n个城市,m条单向边,求通过最短路径访问四个不同的点能获得的最大距离,答案输出一 ...

  8. bzoj 1028 暴力枚举判断

    昨天梦到这道题了,所以一定要A掉(其实梦到了3道,有两道记不清了) 暴力枚举等的是哪张牌,将是哪张牌,然后贪心的判断就行了. 对于一个状态判断是否为胡牌,1-n扫一遍,然后对于每个牌,先mod 3, ...

  9. POJ-3187 Backward Digit Sums (暴力枚举)

    http://poj.org/problem?id=3187 给定一个个数n和sum,让你求原始序列,如果有多个输出字典序最小的. 暴力枚举题,枚举生成的每一个全排列,符合即退出. dfs版: #in ...

随机推荐

  1. javascript常用对象方法

    concat:连接产生一个新数组 [1,2].concat([3,4])     >> [1, 2, 3, 4] filter:返回符合条件的一个新数组 [1,2,3,4,5].filte ...

  2. struts2源码分析-初始化流程

    这一篇文章主要是记录struts.xml的初始化,还原struts2.xml的初始化流程.源码依据struts2-2.3.16.3版本. struts2初始化入口,位于web.xml中: <fi ...

  3. [Clr via C#读书笔记]Cp18 定制Attribute

    Cp18 定制Attribute 意义 利用Attribute,可以声明性的给自己的代码结构创建注解,从而实现一些特殊的功能:最终在元数据中生成,这种可扩展的元数据信息可以在运行时的时候查询,从而动态 ...

  4. isX字符串方法

    islower():返回True,如果字符串至少有一个字母,并且所有字母都是小写: 例如:>>> spam='Hello world' >>> spam.islow ...

  5. Python3 Tkinter-Scrollbar

    1.创建 from tkinter import * root=Tk() Scrollbar(root).pack() root.mainloop() 2.设置silder的位置 from tkint ...

  6. 十:HDFS Short-Circuit Local Reads 短路本地读取

    当client请求数据时,datanode会读取数据然后通过TCP协议发送给client.short-circuit绕过了datanode直接读取数据.short-circuit的前提是client和 ...

  7. 欢迎来怼--第七次Scrum会议

    一.小组信息 队名:欢迎来怼 小组成员: 队长:田继平 成员:李圆圆,葛美义,王伟东,姜珊,邵朔,冉华 小组照片 二.开会信息 时间:2017/10/19 17:05~17:17,总计12min. 地 ...

  8. HDU 5794 A Simple Chess dp+Lucas

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5794 A Simple Chess Time Limit: 2000/1000 MS (Java/O ...

  9. iOS开发NSDate详解

    1. 用于创建NSDate实例的类方法有 + (id)date; 返回当前时间 + (id)dateWithTimeIntervalSinceNow:(NSTimeInterval)secs; 返回以 ...

  10. android gradle打包常见问题及解决方案

    背景: 问题: Q1: UNEXPECTED TOP-LEVEL ERROR: java.lang.OutOfMemoryError: Java heap space at com.android.d ...