#include <stdio.h> #include <string.h> bool vis[11]; int n, k; bool judge(int x) { memset(vis, false, sizeof(vis)); if (x == 0) vis[0] = true; while (x) { vis[x%10] = true; x /= 10; } for (int i = 0; i <= k; i++) if (vis[i] == false) return…
B. Smallest number Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/55/problem/B Description Recently, Vladimir got bad mark in algebra again. To avoid such unpleasant events in future he decided to train his arithmetic skil…
这一篇博客主要是说Office 365 Pro plus安装. 1. 当登陆到Office 365以后,点击右边链接“下载软件” 2. 安装最新Office 软件 3. 采用点对点安装,当安装成功以后,开始-程序-microsoft Office 2013,可以看到你安装的Office 365 pro plus:大家注意在这里名字是Office 2013,关于Office 2013和Office 365 pro plus的区别,请看我上一篇博客. 4. 打开Excel,创建一篇新文档,并保存到O…
题目链接:http://codeforces.com/problemset/problem/617/E 一看这种区间查询的题目,考虑一下莫队. 如何${O(1)}$的修改和查询呢? 令${f(i,j)}$表示区间${\left [ l,r \right ]}$内数字的异或和. 那么:${f(l,r)=f(1,r)~~xor~~f(1,l-1)=k}$ 记一下前缀异或和即可维护. #include<iostream> #include<cstdio> #include<algo…
题目链接: E. XOR and Favorite Number time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output Bob has a favorite number k and ai of length n. Now he asks you to answer m queries. Each query is given by…
You've got array a[1], a[2], ..., a[n], consisting of n integers. Count the number of ways to split all the elements of the array into three contiguous parts so that the sum of elements in each part is the same. More formally, you need to find the nu…
time limit per test4 seconds memory limit per test256 megabytes inputstandard input outputstandard output Bob has a favorite number k and ai of length n. Now he asks you to answer m queries. Each query is given by a pair li and ri and asks you to cou…
http://codeforces.com/problemset/problem/617/E 题意:给出n个数,q个询问区间,问这个区间里面有多少个区间[i,j]可以使得ai^ai+1^...^aj = k. 思路:根据xor的性质,可以处理出前缀异或和sum[],那么要使结果等于k,就是sum[i-1]^sum[j] == k,即sum[j]^k == sum[i-1],那么用一个数组cnt[]存储对于每一个sum[]的数量.然后用莫队算法做.莫队算法是一种离线处理区间问题的算法,在我看来是将…
题目链接:http://codeforces.com/problemset/problem/617/E 题目: 给你a1 a2 a3 ··· an 个数,m次询问:在[L, R] 里面又多少中 [l, r] 使得 al xor al+1 xor ··· ar 为 k. 题解: 本题只有区间查询没有区间修改,而且数据量不大(10w),所以可以用离线的方法解决. 使用莫队算法来解决,就需要O(1)的修改[L, R+1] .[L, R-1].[L+1, R].[L-1, R]. 详细的莫队可以百度学一…
题目链接:https://codeforces.com/contest/1370/problem/C 题意 给出一个正整数 $n$,Ashishgup 和 FastestFinger 依次选择执行以下一个操作: 如果 $n > 1$,使 $n$ 除以一个奇因子 如果 $n > 1$,使 $n$ 减一 若一方不能操作,则另一方胜利. 题解 奇数根据 $n = 1$ 分为两种情况. 偶数根据是否含有奇因子分为两种情况,不含奇因子根据是否为 $2$ 分为两种情况,含有奇因子根据 $2$ 的个数和奇因…