上一场CF打到心态爆炸,这几天也没啥想干的 A Math Problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 0    Accepted Submission(s): 0 Problem Description You are given a positive integer n, please count how many…
Problem Description Nike likes playing cards and makes a problem of it. Now give you n integers, ai(1≤i≤n) We define two identical numbers (eg: 2,2) a Duizi, and three consecutive positive integers (eg: 2,3,4) a Shunzi. Now you want to use these inte…
Problem Description Monkey A lives on a tree, he always plays on this tree. One day, monkey A learned about one of the bit-operations, xor. He was keen of this interesting operation and wanted to practise it at once. Monkey A gave a value to each nod…
Problem Description Bob's school has a big playground, boys and girls always play games here after school. To protect boys and girls from getting hurt when playing happily on the playground, rich boy Bob decided to cover the playground using his carp…
HDU 6188 Duizi and Shunzi 链接:http://acm.hdu.edu.cn/showproblem.php?pid=6188 思路: 签到题,以前写的. 实现代码: #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> #include<stack> #include<map&g…
2017-08-31 16:48:00 writer:pprp 这个题比较容易,我用的是快速幂 写了一次就过了 题目如下: A Math Problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 0    Accepted Submission(s): 0 Problem Description You are given a po…
2017-08-31 16:19:30 writer:pprp 这道题快要卡死我了,队友已经告诉我思路了,但是做题速度很缓慢,很费力,想必是因为之前 的训练都是面向题解编程的缘故吧,以后不能这样了,另外这几天要学习一下动态规划, 先普及两个小知识点,这个点很简单很简单但是却卡了我很久很久, 现在作为模板记录下来: 1.将二进制数转化为十进制数 //转化为十进制 //test:ok ll twoTen(int a[]) { ll ans = ; ; i < N ; i++) { ans += (…
题意 给一颗\(n\)个节点的带点权的树,以\(1\)为根节点,\(q\)次询问,每次询问给出2个数\(u\),\(x\),求\(u\)的子树中的点上的值与\(x\)异或的值最大为多少 分析 先dfs一遍,得到dfs序,就可以将这个问题转化为求区间\([l,r]\)中的值与\(x\)异或值最大的经典问题, 就按dfs序建可持久化01字典树,查询的时候查区间\([in[u],out[u]]\)就行了,\(in[u]\)和\(out[u]\)存的分别是\(u\)的子树上的节点在dfs序上的起始位置和…
A.A Math Problem #include <bits/stdc++.h> using namespace std; typedef long long ll; inline ll read(){ ,f=;char ch=getchar(); ;ch=getchar();} +ch-';ch=getchar();} return x*f; } /***********************************************************/ ; ll a[max…
题意:就是一个集合分开,有两种区分 对子:两个相同数字,顺子:连续三个不同数字,问最多分多少个 解法:贪心,如果当前数字不构成顺子就取对子 /2,如果可以取顺子,那么先取顺子再取对子 #include <iostream> #include <stdio.h> #include <vector> #include <string.h> #include <map> using namespace std; struct Node{ int x,y…
题意:删除指定数字,求剩下数字的与或非值 解法:保存一下前缀和后缀 #include <iostream> #include <stdio.h> #include <vector> #include <string.h> #include <map> using namespace std; ],y1[],z1[]; ],y2[],z2[]; ]; map<int,int>Mp; int n,m; map<int,int>…
解法:发现..最多15个,那么..暴力一下啦 #include <iostream> #include <stdio.h> #include <vector> #include <string.h> #include <map> using namespace std; struct Node{ int x,y; }node[]; map<int,int>Mp; long long n; map<int,int>::ite…
Query on A Tree Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 132768/132768 K (Java/Others) Problem Description Monkey A lives on a tree, he always plays on this tree. One day, monkey A learned about one of the bit-operations, xor. He was…
Color it Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 132768/132768 K (Java/Others)Total Submission(s): 0    Accepted Submission(s): 0 Problem Description Do you like painting? Little D doesn't like painting, especially messy color paint…
Duizi and Shunzi Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 0    Accepted Submission(s): 0 Problem Description Nike likes playing cards and makes a problem of it. Now give you n integers, a…
CS Course Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 0    Accepted Submission(s): 0 Problem Description Little A has come to college and majored in Computer and Science. Today he has learne…
Covering Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 0    Accepted Submission(s): 0 Problem Description Bob's school has a big playground, boys and girls always play games here after school.…
Covering Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 187    Accepted Submission(s): 107 Problem Description Bob's school has a big playground, boys and girls always play games here after sch…
周六周末组队训练赛. Dogs' Candies Time Limit: 30000/30000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others)Total Submission(s): 3920    Accepted Submission(s): 941 Problem Description Far far away, there live a lot of dogs in the forest. Unlike…
Little Zu Chongzhi's Triangles Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others)Total Submission(s): 2515    Accepted Submission(s): 1427 Problem Description Zu Chongzhi (429–500) was a prominent Chinese mathematic…
Song Jiang's rank list Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others)Total Submission(s): 2006    Accepted Submission(s): 1128 Problem Description <Shui Hu Zhuan>,also <Water Margin>was written by Shi Nai…
F - Almost Sorted Array Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 5532 Description We are all familiar with sorting algorithms: quick sort, merge sort, heap sort, insertion sort, selectio…
解题过程 中午吃饭比较晚,到机房lfw开始发各队的账号密码,byf开始读D题,shl电脑卡的要死,启动中...然后听到谁说A题过了好多,然后shl让blf读A题,A题blf一下就A了.然后lfw读完M题(shl的电脑终于打开了,然后输入密码,密码错误...自闭),说AC 自动机板题,然后找板子,,,突然发现自己读错题目.后来不知道怎么A的.shl copy了一遍密码终于登上账号.然后lfw一个人用单调栈和前缀和st表A掉了I题:byf 秒了H题: shl和byf读j题,读完吧题意告诉lfw,lf…
CS Course Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 0    Accepted Submission(s): 0 Problem Description Little A has come to college and majored in Computer and Science. Today he has learne…
就是求区间和与区间最小值的积的最大值 但是a[i]可能是负的 这就很坑 赛后看了好多dalao的博客 终于a了 这个问题我感觉可以分为两个步骤 第一步是对于每个元素 以它为最小值的最大区间是什么 第二步是找出来在这个区间里面 最大的连续和多少 那么我们怎么找到第一步这个最大区间呢 可以先找这个元素左边第一个比他小的值的下标 和右边第一个比他小的值的下标 这两个下标确定了 最大区间就确定了 怎么找这个下标呢 暴力的话时间复杂度太高 是n^2 需要使用单调栈: 单调栈 顾名思义就是元素都是单调递增或…
题目链接:https://nanti.jisuanke.com/t/38232 就是判断输入是不是子序列 没想到贡献了将近十几次罚时..........可以说是菜的真实了 用cin cout超时了 改了scanf printf才过 #include<bits/stdc++.h> using namespace std; int main() { ],b[]; cin>>a; int nn=strlen(a); int n; cin>>n; while(n--) { sc…
说明 \(\oplus x​\)为累异或 $ x^{\oplus(a)}​$为异或幂 题意&解法 题库链接 $ f(l,r)=\oplus_{i=l}^{r} a[i]$ $ g(l,r)=\oplus_{i=l}^{r}a[i]^{\oplus((i-l+1)*(r-i+1))}$ \(\begin{alignat}{} w(l,r)&=\oplus_{i=l}^{r}a[i]^{\oplus(\frac{(i-l+1)*(i-l+2)}2*\frac{(r-i+1)*(i-l+2)}2…
A Curious Matt Time Limit: 2000/2000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java/Others)Total Submission(s): 3058    Accepted Submission(s): 1716 Problem Description There is a curious man called Matt. One day, Matt's best friend Ted is w…
题目链接  Problems HDOJ上的题目顺序可能和现场比赛的题目顺序不一样, 我这里的是按照HDOJ的题目顺序来写的. Problem 1001 签到 #include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for (int i(a); i <= (b); ++i) typedef long long LL; LL n, f[31]; int ans; int main(){ f[1] = 1LL; fo…
Kingdom of Black and White                                                                                                            Time Limit: 2000/1000 MS (Java/Others)                                                                             …