P1010 幂次方

摘要: 这么难得题,居然普及 ?做了好久 阅读全文
posted @ 2016-11-03 18:46 蒟蒻konjac 阅读(226) 评论(0) 推荐(0) 编辑

P1434 滑雪

摘要: 水题,记忆化搜索,队列bfs均可 我们定义f[i][j]为到(i, j)的最长路径。然后就不难得出状态转移方程,然后使用无脑dfs,或者有脑递推都是可以的。 include using namespace std; const int maxn = 105; const int dx[] = {0, 阅读全文
posted @ 2016-11-03 10:52 蒟蒻konjac 阅读(228) 评论(0) 推荐(0) 编辑

P1091 合唱队形

摘要: 水题 include using namespace std; const int maxn = 105; int main(int argc, char const argv[]) { int n; cin n; int high[maxn]; for(int i = 1; i high[i]; 阅读全文
posted @ 2016-11-03 10:25 蒟蒻konjac 阅读(170) 评论(0) 推荐(1) 编辑

P1090 合并果子

摘要: ``` include using namespace std; const int maxn = 10005; int main(int argc, char const argv[]) { int a[maxn]; int n; cin n; priority_queue, greater q; 阅读全文
posted @ 2016-11-02 21:01 蒟蒻konjac 阅读(156) 评论(0) 推荐(0) 编辑

P2672 推销员

摘要: 贪心,水题 include using namespace std; const int maxn = 1000000; struct house { int s; int a; int value; }hs[maxn]; bool operator n; for(int i = 1; i hs[i 阅读全文
posted @ 2016-11-02 17:02 蒟蒻konjac 阅读(194) 评论(0) 推荐(0) 编辑

P2661 信息传递 TODO-TARJAN算法

摘要: http://www.cnblogs.com/zbtrs/p/5762788.html http://blog.csdn.net/loi_yzs/article/details/52795093 都是不错的解析,我在这里就不多说了 include using namespace std; const 阅读全文
posted @ 2016-11-01 21:01 蒟蒻konjac 阅读(149) 评论(0) 推荐(0) 编辑

P1965 转圈游戏

摘要: 很容易可以得到,答案应该是(x+m 10^k)%n 很显然,用O(n)一定会卡爆,所以用快速幂来算,或者找一下循环节也是可以的。 include using namespace std; int Fact(int x, int n, int mod) { int ans = 1; while(n) 阅读全文
posted @ 2016-10-30 15:39 蒟蒻konjac 阅读(170) 评论(0) 推荐(0) 编辑

P1371 NOI元丹

摘要: luogu月赛的题 本来想爆搜,但是经过ly大佬的点拨,明白这是一个dp。 我们定义dp[n]为从n开始的可行串的数目,具体如下:如果n为‘I',则是从n开始有多少个I,如果n为'O',既是从n开始有多少个’OI‘,如果n为’N‘,则是从n开始有多少个’NOI' 我们已经定义了状态,那么怎么转移呢? 阅读全文
posted @ 2016-10-29 21:02 蒟蒻konjac 阅读(180) 评论(0) 推荐(0) 编辑

P2409 Y的积木

摘要: luogu月赛 暴力dfs,估计过不了几个点,大概也就得30分左右? include using namespace std; const int maxn = 55; int jimu[maxn][maxn]; int cnt = 0; int ans[maxn]; int n, k; int a 阅读全文
posted @ 2016-10-29 17:00 蒟蒻konjac 阅读(161) 评论(0) 推荐(0) 编辑

对拍

摘要: 写了一个对拍。用于测试跳马的程序 首先是随机数生成程序: 效果还不错! 阅读全文
posted @ 2016-10-29 16:32 蒟蒻konjac 阅读(117) 评论(0) 推荐(0) 编辑