摘要: 题目:A Coin Problem原题链接:http://acm.uestc.edu.cn/problem.php?pid=1468分析:满足裴波纳契数列,打表找周期。 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 #define mod 10000 8 int dp[15005]; 9 void F(int n)10 {11 dp[0]=1;dp[1]=2;12 for(int i=2;i<=n;i++)13 dp[i]=(dp[i-1]+dp[i-2])... 阅读全文
posted @ 2013-09-17 19:58 EtheGreat 阅读(87) 评论(0) 推荐(0) 编辑
摘要: 题目:Easy math原题链接:http://acm.uestc.edu.cn/problem.php?pid=1548分析:费马小定理的应用。 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 #define LL long long 7 const LL mod=1000000007; 8 LL pow_mod(LL a,LL b,LL m) 9 {10 if(b==0)return 1%m;11 LL temp=pow_mod(a,b>>1,m);12 temp=temp*t... 阅读全文
posted @ 2013-09-17 16:49 EtheGreat 阅读(142) 评论(0) 推荐(0) 编辑