HDU 4475 Downward paths (找规律)
2016-01-31 21:17
357 查看
题意就不解释了,很简单,只要把规律找到就行。
代码:
代码:
[code]// // Created by CQU_CST_WuErli // Copyright (c) 2015 CQU_CST_WuErli. All rights reserved. // // #include<bits/stdc++.h> #include <iostream> #include <cstring> #include <cstdio> #include <cstdlib> #include <cctype> #include <cmath> #include <string> #include <vector> #include <list> #include <map> #include <queue> #include <stack> #include <set> #include <algorithm> #include <sstream> #define CLR(x) memset(x,0,sizeof(x)) #define OFF(x) memset(x,-1,sizeof(x)) #define MEM(x,a) memset((x),(a),sizeof(x)) #define For_UVa if (kase!=1) cout << endl #define BUG cout << "I am here" << endl #define lookln(x) cout << #x << "=" << x << endl #define SI(a) scanf("%d",&a) #define SII(a,b) scanf("%d%d",&a,&b) #define SIII(a,b,c) scanf("%d%d%d",&a,&b,&c) #define rep(flag,start,end) for(int flag=start;flag<=end;flag++) #define Rep(flag,start,end) for(int flag=start;flag>=end;flag--) #define Lson l,mid,rt<<1 #define Rson mid+1,r,rt<<1|1 #define Root 1,n,1 #define BigInteger bign template <typename T> T gcd(const T& a,const T& b) {return b==0?a:gcd(b,a%b);} const int MAX_L=2005;// For BigInteger const int INF_INT=0x3f3f3f3f; const long long INF_LL=0x7fffffff; const int MOD=1000003; const double eps=1e-9; const double pi=acos(-1); typedef long long ll; using namespace std; int t; ll n; ll dp[1000010]; void init() { dp[1]=2; rep(i,2,1000003) dp[i]=dp[i-1]*2*i%MOD; } int main(){ #ifdef LOCAL // freopen("C:\\Users\\john\\Desktop\\in.txt","r",stdin); // freopen("C:\\Users\\john\\Desktop\\out.txt","w",stdout); #endif init(); SI(t); while (t--) { cin >> n; if (n>MOD) cout << 0 << endl; else cout << dp << endl; } return 0; }
相关文章推荐
- Stack&Vector源码解析
- 九度oj 最大公约数(gcd)(这缩写!!!) 最小公倍数(lcm) 1056,1438,1439
- HDU 1301 && POJ 1251 jungle Roads
- Linux主要发行版本中提供的网络工具
- 2016-1-30 linux基础学习4
- 303+304. Range Sum Query && Range Sum Query 2D
- 单例模式
- ngTable动态更新的三种方式
- Linux下的正则表达式
- Linux系统一些知识
- HTML对字体的所有操作详解(经典)
- c语言:用scanf函数输入数据,举例并分析错误原因
- Linux数据库服务器的性能调优
- 使用虚拟登录页面jsp,跳过登录页,直接访问主页面
- Codeforces 204A Little Elephant and Interval(数位统计)
- Linux基本命令
- VMware vSphere搭建云计算基础架构
- javah导出类的头文件抛出异常——java.lang.IllegalArgumentException: Not a valid class name(原因及解决方法)
- awk程序
- EXPRESS.JS再出发