[BZOJ1583] [Usaco2009 Mar]Moon Mooing 哞哞叫(队列)


传送门

思想有点像蚯蚓那个题

#include <cstdio> #define N 0001 #define LL long long #define min(x, y) ((x) < (y) ? (x) : (y)) #define max(x, y) ((x) > (y) ? (x) : (y)) LL q1[N], q2[N]; LL a1, b1, d1, a2, b2, d2; int n, h1 = 1, t1 = 1, h2 = 1, t2; int main() printf("%lld\n", x); return 0; }

  

来自洛谷的更简便的题解

#include <cstdio> #include <iostream> typedef unsigned long long ull; //注意本题要用unsigned long long。 const int N = 0000; ull a[N+5]; //这里我们将a数组看成一个队列 inline ull mn(ull x, ull y) int main() //重点理解while循环的内容。因为算出的F1()或F2()的数据单调递增,所以可以用这样的方式生成整个数列 std::cout << a[n]; //最后输出即可。 return 0; } //祝各位早日AC此题!

  



上一篇:[BZOJ1663] [Usaco2006 Open]赶集(spfa最长路)

下一篇:[POJ2778]DNA Sequence(AC自动机 + DP + 矩阵优化)


模拟 队列
Copyright © 2002-2019 k262电脑网 www.k262.cn 皖ICP备2020016292号
温馨提示:部分文章图片数据来源与网络,仅供参考!版权归原作者所有,如有侵权请联系删除!QQ:251442993 热门搜索 网站地图