Grids
Grids
Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)
Total Submission(s): 717 Accepted Submission(s): 296
然后T行,每行为一个数N(1<=N<=1000000)表示长方形的大小。
1
5
对于第二组样例,共5种方案,具体方案为:
1 #include<stdio.h>
2 #include<algorithm>
3 #include<iostream>
4 #include<string.h>
5 #include<queue>
6 #include<stack>
7 #include<set>
8 #include<math.h>
9 using namespace std;
10 typedef long long LL;
11 const int N=1e9+7;
12 LL dp[1000005];
13 LL quick(LL n,LL m);
14 int main(void)
15 {
16 int i,j,k;
17 dp[1]=1;
18 dp[2]=2;
19 dp[3]=5;
20 for(i=4; i<=1000000; i++)
21 {
22 dp[i]=dp[i-1]*(4*i-2)%N;
23 dp[i]=dp[i]*quick((LL)(i+1),N-2)%N;
24 }
25 scanf("%d",&k);
26 int s;
27 int t;
28 for(s=1; s<=k; s++)
29 {
30 scanf("%d",&t);
31 printf("Case #%d:\n",s);
32 printf("%lld\n",dp[t]);
33 }
34 return 0;
35 }
36 LL quick(LL n,LL m)
37 {
38 LL ak=1;
39 while(m)
40 {
41 if(m&1)
42 {
43 ak=ak*n%N;
44 }
45 n=(n*n)%N;
46 m/=2;
47 }
48 return ak;
49 }
Grids的更多相关文章
- ExtJS笔记 Grids
参考:http://blog.csdn.net/zhangxin09/article/details/6885175 The Grid Panel is one of the centerpieces ...
- hdu 4828 Grids 卡特兰数+逆元
Grids Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others) Problem D ...
- hdu 4828 Grids(拓展欧几里得+卡特兰数)
题目链接:hdu 4828 Grids 题目大意:略. 解题思路:将上一行看成是入栈,下一行看成是出栈,那么执着的方案就是卡特兰数,用递推的方式求解. #include <cstdio> ...
- A Multipart Series on Grids in ASP.NET MVC
A Multipart Series on Grids in ASP.NET MVC Displaying a grid of data is one of the most common tasks ...
- [HDU 4828] Grids
Grids Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)Total Subm ...
- Cohort Analysis and LifeCycle Grids mixed segmentation with R(转)
This is the third post about LifeCycle Grids. You can find the first post about the sense of LifeCyc ...
- Customer segmentation – LifeCycle Grids, CLV and CAC with R(转)
We studied a very powerful approach for customer segmentation in the previous post, which is based o ...
- Customer segmentation – LifeCycle Grids with R(转)
I want to share a very powerful approach for customer segmentation in this post. It is based on cust ...
- 正六边形网格化(Hexagonal Grids)原理与实现
在路径规划.游戏设计栅格法应用中,正六边形网格不如矩形网格直接和常见,但是正六边形具有自身的应用特点,更适用于一些特殊场景中,比如旷阔的海洋.区域或者太空.本文主要讲述如何对正六边形进行几何学分析.网 ...
- ACM程序设计选修课——1065: Operations on Grids(暴力字符串)
1065: Operations on Grids Time Limit: 3 Sec Memory Limit: 128 MB Submit: 17 Solved: 4 [Submit][Sta ...
随机推荐
- 使用SpringBoot实现文件的上传
使用SpringBoot实现文件的上传 springboot可以直接使用 org.springframework.web.multipart.MultipartFile 所以非常容易实现 一.首先是简 ...
- Elasticsearch中关于transform的一个问题?
背景:现在有一个业务,派件业务,业务员今天去派件(扫描产生一条派件记录),派件可能会有重复派件的情况,第二天再派送(记录被更新,以最新的派件操作为准).现在需要分业务员按天统计每天的派件数量.es版本 ...
- day19 进程管理
day19 进程管理 什么是进程,什么是线程 1.什么是程序 一般情况下,代码,安装包等全部都是应用程序 2.什么是进程 进程(Process)是计算机中的程序关于某数据集合上的一次运行活动,是系统进 ...
- 25. Linux下gdb调试
1.什么是core文件?有问题的程序运行后,产生"段错误 (核心已转储)"时生成的具有堆栈信息和调试信息的文件. 编译时需要加 -g 选项使程序生成调试信息: gcc -g cor ...
- Linux磁盘分区(三)之查看磁盘分区常用命令
Linux磁盘分区(三)之查看磁盘分区常用命令转自https://blog.csdn.net/x356982611/article/details/77893264 1.df df -T 总的 ...
- GO 数字运算
大整数运算 // bigint project main.go package main import ( "fmt" "math" "math/bi ...
- mysql读写分离(proxySQL) lamp+proxysql+nfs
先在主从节点安装mysql [root@master-mariadb ~]# yum install mariadb-server -y [root@slave-mariadb ~]# yum ins ...
- ES6(模板字符串,三点运算符,Symbol,iterator接口)
模板字符串 作用:简化字符串的拼接 模板字符串必须用``包含 变化的部分使用${xxx}包含 对象的简写方式 同名的属性可以省略不写 可以省略函数的function 箭头函数 箭头函数的特点 箭头函数 ...
- Mybatis读取数据实战
1.Mybatis基础配置 <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE configu ...
- 【MySQL】亲测可用的教程筛选:安装与卸载
windows版本的 安装看这篇,非常详细:https://www.cnblogs.com/winton-nfs/p/11524007.html 彻底清除:https://www.pianshen.c ...