Interesting Sum - 题解【思维】 前言 在vscode上配置了markdown插件,取代了之前写md的工具,本博客用来测试插件好不好用,所以选的题比较简单。但是jiangly这道题被FST了【滑稽】 题面 本题是Codeforces #815 Div.2的B题。原题链接见:B.Interesting Sum。下面搬运一下题面: You are gi
Description We'll call an array of n non-negative integers a[1], a[2], ..., a[n]interesting, if it meets m constraints. The i-th of the m constraints consists of three integers li, ri, qi (1 ≤ li ≤ ri ≤ n) meaning that value shoul
题意 给定序列a,给定 m 个询问\(l,r\),要求每个询问回答\([l,r]\)内出现次数为偶数的数的异或和 题解 发现直接前缀和异或,得到的是出现次数为奇数的数的异或和 于是问题转化成了求出区间内出现过的数的异或和 将询问离线按右端点排序,线段树做扫描线 具体来说就是记一个 last 数组,\(l
题目链接 题意 给定 \(n\) 个只含 \(a\) 到 \(e\) 的字符串,求最多能选出多少个字符串,使得存在某个字母出现次数严格大于其它字母。 分析 首先我们看下数据范围,2e5的然后\(a-e\)只有5个字符,所以我们可以贪心的想,就是把符合的提取出来就行了,严格大于其他字符是说,某一字符数量大于其
题目传送门:https://codeforces.com/problemset/problem/482/B 题目大意: 给定\(m\)条限制,每条限制形如\(l_i,r_i,p_i\),表示序列\(A\)的\(A_{l_i}\&A_{l_i+1}\&...\&A_{r_i}=p_i\),问是否存在序列\(A\)满足\(m\)条限制 因为需要满足\(A_{l_i}\&A_{l_i+1}\&...\&A_{r_i}=p_i
这篇文章介绍一下数论,积性函数求和,以及杜教筛,powerful number 筛,min25 三种筛法 在这之前,我们先来介绍一下一些有趣的东西 Bell series 贝尔级数,对于一个数论函数 \(f\) 和质数 \(p\),定义 \(f_p(x)=\sum_{n\ge 0}f(p^n)x^n\) 对于两个数论函数 \(f,g\) 的狄利克雷卷积,不妨设为 \(h
#include <bits/stdc++.h> using namespace std; using ll = long long ; ll solve(int n){ ll ans=0; for(int i=1;i<=10;i++) ans+=n/(int)(pow(10,i-1)); return ans; } int main() { ios::sync_with_stdio(false); int l,r; int
题意: 解法: 发现每组询问其实就是给定x,计算序列中有多少个数<=x. 发现序列中的数不是很大,直接桶排序+前缀和预处理出a[x]为<=x的数有多少个. 每次询问O(1)输出即可. code: #include<bits/stdc++.h> #define int long long using namespace std; const int maxm=2e6+5; in
题目链接 https://codeforces.com/problemset/problem/387/D 题意 思路 \(N\)不大,考虑枚举中心点\(u\), 首先和\(u\)相连的边加上自环共有\(2 * n - 1\)条, 那么将不够的边补上。 每个边都和\(u\)有双向边之后, 入度和出度还剩1. 将剩下\(n - 1\) 个点拆成入度点和出度点, 那么每个
2020牛客暑期多校训练营(第八场)I Interesting Computer Game 题解: 用并查集写即可。 #include <bits/stdc++.h> #define debug(x) cout<<"debug:"<<" "<<#x<<"="<<x<<endl; using namespace std; const int maxn = 4e5
第七篇Scrum冲刺博客 站立式会议 1.会议照片 2.队友完成情况 团队成员 昨日完成 今日计划 鲍鱼铭 各界面数据请求云函数设计及实现 代码交接及整体架构搭建 叶学涛 进行代码优化 和队友进行交接 许铭楷 测试及代码优化 交接代码 陈锐填 导入所有数据,包括歌手,专辑,歌
第三篇Scrum冲刺博客 站立式会议 1.会议照片 2.队友完成情况 团队成员 昨日完成 今日计划 鲍鱼铭 主页页面跳转社区功能及社区设计及布局实现 搜索页面跳转、设计及布局实现 叶学涛 编写个人页面 编写设置页面 许铭楷 编辑个人资料界面页面设计及布局实现 个人空间展
20200227 说实话,日记断了这么久,我甚至于忘了,还有这样一个手艺能让我记录我的日子,想想每天6.00 醒,醒来疯狂自律那一段日子,真是怀念啊,被这个所谓的破病毒搞得人都傻掉,我还是选择一个在这晃晃悠悠,还记得上一次我去打游戏是什么时候,可能大概也许 都快忘了。狂奔向网吧,现在却变成了 默
题意: 给定参数 n,m,a,bn,m,a,b 你现在要构造一颗 nn 个点树,树边的权值可以赋为 [1,m][1,m]中的一个整数。 求有多少种构造树的方法,使得节点 aa 与节点 bb 在树上的最短路径恰好为 mm 。 对 10^9+7109+7 取模 题解: 组合数处理一下,还要用到下面的公式: Cayley公式:
https://codeforces.com/contest/1270/problem/B 思路:由样例发现公差为1的等差数列不满足条件 对于∀的l,r max(a)-min(a)=|r-l|<r-l+1 由此想到若任意相邻两项差的绝对值为1 则不满足条件 反过来若存在相邻两项差的绝对
链接: https://codeforces.com/gym/102394/problem/I 题意: DreamGrid has an interesting permutation of 1,2,…,n denoted by a1,a2,…,an. He generates three sequences f, g and h, all of length n, according to the permutation a in the way described below: For each 1
from urllib.request import urlopenhtml = urlopen("http://pythonscraping.com/pages/page1.html")print(html.read()) output b'<html>\n<head>\n<title>A Useful Page</title>\n</head>\n<body>\n<h1>
题意: 找出所有【i,j】为回文串【j+1,k】也为回文串的i*k乘积之和。 题解: 设sum1【i】 为正着插入,到 i 的所有回文串的起始位置的前缀和,sum2【i】 表示反正插入的前缀和 ans+=sum1【i]*sum1【i+1】 上面的式子很容易让我们想到两遍回文树正着和反着插入操作, 回文树的num【】表示到
原文链接:http://www.cnblogs.com/youth0826/archive/2012/12/06/2804859.html Some Interesting Papers from NIPS 2012 W. Koolen, D. Adamskiy, M. WarmuthPutting Bayes to sleepSome signals look sort of jump Markov — the distribution o
Variable, or There and Back Again CodeForces - 164A Life is not easy for the perfectly common variable named Vasya. Wherever it goes, it is either assigned a value, or simply ignored, or is being used! Vasya's life goes in states of a program. In
题目描述: D. Interesting Arraytime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputWe'll call an array of n non-negative integers a[1], a[2], ..., a[n] interesting, if it meets m constraints. The i-th of th
A. Nearest Interesting Number 题目链接:http://codeforces.com/contest/1183/problem/A 题目: Polycarp knows that if the sum of the digits of a number is divisible by 3, then the number itself is divisible by 3. He assumes that the numbe
Interesting visualization tools for profiling. http://dtrace.org/blogs/brendan/2012/03/17/linux-kernel-performance-flame-graphs/ http://dtrace.org/blogs/brendan/2013/07/01/detecting-outliers/ 转载于:https://www.cnblogs.com/kungfupanda/p/3245651.html
题目描述: Dr.Kong has taken a side job designing interesting punch-bowl designs. The designs are created as follows: * A flat board of size W cm * H cm is procured (3 <= W <= 300, 3 <= H <= 300) * On every 1 cm x
Sasha and Interesting Fact from Graph Theory n 个 点形成 m 个有标号森林的方案数为 F(n, m) = m * n ^ {n - 1 - m} 然后就没啥难度了。。。 #include<bits/stdc++.h>#define LL long long#define LD long double#define ull unsigned long long#define fi first#define se s