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 ...
随机推荐
- jquery时间轴tab切换效果实现结合swiper实现滑动显示效果
需求:根据时间轴进行tab页面内容切换(时间轴需要滑动查看并选择) 实现思路: 结合swiper插件实现滑动显示效果 根据transform: translateX进行左侧切换效果的实现(具体实现cs ...
- 第一个基础框架 — mybatis框架 — 更新完毕
1.Mybatis是什么? 百度百科一手 提取一下重点: MyBatis 本是apache的一个开源项目iBatis.即:mybatis的原名为:ibatis 2010年迁移到google code, ...
- HTML5 基础内容(元素/属性/格式化)
HTML基础 1.HTML元素 1.1 元素指的是开始标签到结束标签的所有代码. 1.2 元素的内容是开始标签与结束标签之间的内容. 1.3大多数HTML元素可用有属性. 1.4标签可以拥有属性为元素 ...
- 源码分析-NameServer
架构设计 消息中间件的设计思路一般是基于主题订阅发布的机制,消息生产者(Producer)发送某一个主题到消息服务器,消息服务器负责将消息持久化存储,消息消费者(Consumer)订阅该兴趣的主题,消 ...
- 「译」 .NET 6 中 gRPC 的新功能
gRPC是一个现代的.跨平台的.高性能的 RPC 框架.gRPC for .NET 构建在 ASP.NET Core 之上,是我们推荐的在 .NET 中构建 RPC 服务的方法. .NET 6 进一步 ...
- Linux基础命令---ntpdate网络时间服务器
ntpdate ntpdate指令通过轮询指定为服务器参数的网络时间协议(NTP)服务器来设置本地日期和时间,从而确定正确的时间. 此命令的适用范围:RedHat.RHEL.Ubuntu.CentOS ...
- Linux磁盘与文件系统原理
这一章主要是原理性的,介绍了Linux文件系统的运作原理.涉及到很多计算机组成和操作系统的原理性知识,这部分知识很多都忘了,在这里复习下. 我们只看本章第1,2节.--------------- ...
- Mysql多字段模糊查询
MySQL同一字段多值模糊查询 一. 同一字段多值模糊查询,使用多个or进行链接,效率不高,但没有更好的解决方案.(有看到CHARINDEX 关键字,可查询结果并不是模糊,举个栗子 例如SELECT ...
- 用户信息系统_serviceImpl
package com.hopetesting.service.impl;import com.hopetesting.dao.UserDao;import com.hopetesting.dao.i ...
- vue cli3.0 首次加载优化
项目经理要求做首页加载优化,打包后从十几兆优化到两兆多,记下来怕下次忘记 运行report脚本 可看到都加载了那些内容,在从dist文件中index.html 查看首次加载都加载了那些东西,如下图:然 ...