1.用退化的线段树(也就是没有区间查询)做... 2.注意longlong. #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> using namespace std; int n,q; int a[200010],s[200010]; int main(){     scanf("%d%d",&n,&q); for(int…
1.首先是要找到一个位置从左至右,作l这一个是0,r这一个是1. 2.实例01011,10100.你将能够找到01111和10000. #include<cstdio> #include<iostream> using namespace std; int main(){ long long l,r,i; scanf("%lld%lld",&l,&r); r=r^l; for(i=1;;i<<=1) if(i>r) break;…
A. Lunch Rush 模拟. B. Little Girl and Game 因为可以打乱顺序,所以只关心每种数字打奇偶性. 若一开始就是回文,即奇数字母为0或1种,则先手获胜. 若奇数字母大于1,则只需要考虑奇数字母个数的奇偶性.因为后手可以保证奇数字母个数的奇偶性. C. Little Girl and Maximum Sum 考虑每个位置覆盖次数,显然覆盖次数多分配大权值. D. Little Girl and Maximum XOR 找到 \(l,r\) 不相同的最高位,那么为了异…
E. Little Girl and Problem on Trees time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A little girl loves problems on trees very much. Here's one of them. A tree is an undirected connected g…
A. Lunch Rush time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Having written another programming contest, three Rabbits decided to grab some lunch. The coach gave the team exactly k time u…
题目传送门 /* 模拟递推水题 */ #include <cstdio> #include <iostream> #include <cmath> #include <algorithm> #include <cstring> #include <string> #include <map> using namespace std; + ; const int INF = 0x3f3f3f3f; int a[MAXN][M…
题目链接:http://www.codeforces.com/problemset/problem/509/A题意:f[i][1]=f[1][i]=1,f[i][j]=f[i-1][j]+f[i][j-1],求f[n][n].C++代码: #include <iostream> using namespace std; ][]; int main() { cin >> n; ;i<=n;i++) f[i][] = f[][i] = ; ; i <= n; i ++) ;…
A. Maximum in Table time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output An n × n table a is defined as follows: The first row and the first column contain ones, that is: ai, 1 = a1, i = 1 for…
题目链接: huangjing hdu5054 Alice and Bob 思路: 就是(x,y)在两个參考系中的表示演全然一样.那么仅仅可能在这个矩形的中点.. 题目: Alice and Bob Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 216    Accepted Submission(s): 166 Problem De…
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate it n = int(raw_input()) s = "" a = ["I hate that ","I love that ", "I hate it","I love it"] for i in ran…