- 博客(7)
- 资源 (1)
- 收藏
- 关注
原创 poj 3070 Fibonacci
第一道矩阵快速幂的题目,其实跟整数的快速幂没什么区别嘛,无非就是多一个矩阵的乘法操作和构造一个单位矩阵 其实这种类型的题目难点在于如何构造出矩阵出来,但这道题直接告诉你了公式,那就是裸的模板题了 #include #include #include #include #include using namespace std; const int MOD = 100
2015-02-20 15:21:21 374
原创 HDU 2817 A sequence of numbers
水题,题目要求的就是等比数列或是等差数列的第k项 等差数列就直接套通项公式嘛 等比数列的话由于k可能非常大,所以要用快速幂 #include #include #include #include using namespace std; #define MOD 200907 int solve(int fac,int num){ if(fac==0) retu
2015-02-19 22:43:10 445
原创 HDU 1301 Jungle Roads
裸的最小生成树 #include #include #include #include using namespace std; const int INF=0x3f3f3f3f; const int maxn=30; bool vis[maxn]; int lowc[maxn]; int cost[maxn][maxn]; int n; int prim(){ int ans=0;
2015-02-17 22:21:58 368
原创 HDU 1010 Tempter of the Bone
一道搜索题,需要加奇偶剪枝,需要注意的地方是题目要求在T时刻时刚好到达D位置。 顺带吐槽一下,调试的时候遇到各种奇葩错误,例如去掉提示信息后,答案居然不一样,尼玛,这么会有这种错误啊啊啊啊。 G++提交WA,C++提交AC又是什么鬼啊 #include #include #include #include using namespace std; int N,M,T; int sx,
2015-02-17 20:13:56 360
原创 Codeforces Round #291 (Div. 2) Han Solo and Lazer Gun
虽然好像是一道水题,但写这篇文章的意义在于——我第一次做出了CF的B题啊啊啊啊。 做法就是计算所有卫兵的点与枪的点之间的斜率(其实用叉积做更好一些),然后对斜率排个序,再扫一遍就可以了嘛。 #include #include #include #include #include using namespace std; #define eps 0.000000001 #define
2015-02-17 16:24:06 552
原创 HDU 5167 Fibonacci
题目要求的是判断一个数是不是Fibonacci数的乘积,前面想当然以为只要是两个数的乘积就行,但显然两个以上的Fibnoacci数的乘积也是可以的。 找到错误之后就用DFS搜索一遍就OK了,但姿势不好的话,就会超时。 姿势不好的dfs int dfs(long long n){ if(n==1) return 1; for(int i=0;i<cnt;i++)
2015-02-02 10:23:11 557
原创 poj 3087 Shuffle'm Up
简单模拟就能搞的题~~~#include #include #include #include using namespace std; char ch1[1000],ch2[1000],ch3[2000]; int main(){ int t; scanf("%d",&t); int cnt=0; string str1,str2,str3; while(++cnt<=t){
2015-02-01 22:42:30 431
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人