地址:http://codeforces.com/contest/768/problem/D 题目: D. Jon and Orbs time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Jon Snow is on the lookout for some orbs required to defeat the white wal…
地址:http://codeforces.com/contest/768/problem/C 题目: C. Jon Snow and his Favourite Number time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output Jon Snow now has to fight with White Walkers. He has…
地址:http://codeforces.com/contest/768/problem/B 题目: B. Code For 1 time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Jon fought bravely to rescue the wildlings who were attacked by the white-w…
地址:http://codeforces.com/problemset/problem/768/A 题目: A. Oath of the Night's Watch time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output "Night gathers, and now my watch begins. It shall not end…
C题卡了好久,A掉C题之后看到自己已经排在好后面说实话有点绝望,最后又过了两题,总算稳住了. AC:ABCDE Rank:191 Rating:2156+37->2193 A.Oath of the Night's Watch 题目大意:给定N个数,求有多少个数存在严格比它大的数和严格比它小的数.(N<=100,000) 思路:阅读能力训练+手速,排序一遍就没了. #include<cstdio> #include<cstring> #include<algori…
A. Oath of the Night's Watch time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output "Night gathers, and now my watch begins. It shall not end until my death. I shall take no wife, hold no lands,…
打表找规律即可. 1,1,2,2,2,3,3,3,3,4,4,4,4,4... 注意打表的时候,sg值不只与剩下的石子数有关,也和之前取走的方案有关. //#include<cstdio> //#include<set> //#include<cstring> //using namespace std; //bool vis[16]; //int n,SG[16][1<<16]; //int sg(int x,int moved) //{ // if(SG…
直接暴力dp就行……f(i,j)表示前i天集齐j种类的可能性.不超过10000天就能满足要求. #include<cstdio> using namespace std; #define EPS 1e-10 int K,q,p; double f[10010][1010]; int main() { // freopen("d.in","r",stdin); scanf("%d%d",&K,&q); f[0][0]=1…
发现值域很小,而且怎么异或都不会超过1023……然后可以使用类似基数排序的思想,每次扫一遍就行了. 复杂度O(k*1024). #include<cstdio> #include<cstring> using namespace std; int n,k,x,cnts[1110],tmpcnts[1110]; int main() { // freopen("c.in","r",stdin); int X; scanf("%d%d%…
观察一下,将整个过程写出来,会发现形成一棵满二叉树,每一层要么全是0,要么全是1. 输出的顺序是其中序遍历. 每一层的序号形成等差数列,就计算一下就可以出来每一层覆盖到的区间的左右端点. 复杂度O(log(n)). #include<cstdio> using namespace std; typedef long long ll; ll n,l,r; bool a[66]; int e; int main() { // freopen("b.in","r&quo…