把每个电梯口看作一个节点, 然后计算边的权值的时候处理一下, 就ok了. #include<cstdio> #include<vector> #include<queue> #include<cmath> #define REP(i, a, b) for(int i = (a); i < (b); i++) using namespace std; const int MAXN = 112; struct Edge { int v, id; }; st…
开始的时候一看这题感觉很难,觉得肯定有什么很快的办法 不能暴力做(受了上一题10-13的影响) 然后一看那个函数感觉无从下手. 然后看了博客发现,原来这道题就是直接暴力-- 因为n的范围为10的7次方啊 ,不会超时 自己以后要注意数据范围 #include<cstdio> #include<cmath> #include<iostream> #define REP(i, a, b) for(int i = (a); i < (b); i++) using name…
自己用手算一下可以发现是斐波那契数列,然后因为数字很大,用高精度 以后做题的时候记得算几个数据找规律 #include<cstdio> #include<cmath> #include<cstring> #include<algorithm> #define REP(i, a, b) for(int i = (a); i < (b); i++) using namespace std; const int MAXN = 11234; const int…
看了其他人博客,貌似i个盘子的方案数满足 f[i] = f[i-1] * x + y ??????? 神来之笔 貌似没有找到严格的证明-- 牛逼-- 如果这样的话暴力求出x和y然后递推完事 #include<cstdio> #include<stack> #define REP(i, a, b) for(int i = (a); i < (b); i++) using namespace std; int s[10][2]; stack<int> st[3]; b…
You are working in a team that writes Incredibly Customizable Programming Codewriter (ICPC) which is basically a text editor with bells and whistles. You are working on a module that takes a piece of code containing some definitions or other tabular…
A Ducci sequence is a sequence of n-tuples of integers. Given an n-tuple of integers (a1, a2, · · · , an), the next n-tuple in the sequence is formed by taking the absolute differences of neighboring integers: (a1, a2, · · · , an) → (|a1 − a2|, |a2 −…