摘要:
水题,记忆化搜索,队列bfs均可 我们定义f[i][j]为到(i, j)的最长路径。然后就不难得出状态转移方程,然后使用无脑dfs,或者有脑递推都是可以的。 include using namespace std; const int maxn = 105; const int dx[] = {0, 阅读全文
摘要:
水题 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]; 阅读全文
摘要:
``` 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; 阅读全文
摘要:
贪心,水题 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 阅读全文
摘要:
http://www.cnblogs.com/zbtrs/p/5762788.html http://blog.csdn.net/loi_yzs/article/details/52795093 都是不错的解析,我在这里就不多说了 include using namespace std; const 阅读全文
摘要:
很容易可以得到,答案应该是(x+m 10^k)%n 很显然,用O(n)一定会卡爆,所以用快速幂来算,或者找一下循环节也是可以的。 include using namespace std; int Fact(int x, int n, int mod) { int ans = 1; while(n) 阅读全文
摘要:
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 阅读全文