cf1216E2 Numerical Sequence (hard version) 题目大意 一个无限长的数字序列,其组成为\(1 1 2 1 2 3 1.......1 2 ... n...\),即重复的\(1~1,1~2....1~n\),给你一个k,求第k(k<=1e18)个数字是什么 solution 暴力枚举妥妥T掉 手摸能看出来每一个单独的序列是等差数列 然后每一个序列的数字个数也是等差数列 如果预处理出等差数列的数组,那么询问的时候直接调用即可 参考lzz的blogs 说说这一段…
题目描述 The only difference between the easy and the hard versions is the maximum value of k. You are given an infinite sequence of form "112123123412345--" which consist of blocks of all consecutive positive integers written one after another. The…
http://codeforces.com/problemset/problem/1216/E1 E1. Numerical Sequence (easy version) time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output The only difference between the easy and the hard ver…
题目 The only difference between the easy and the hard versions is the maximum value of k. You are given an infinite sequence of form "112123123412345…" which consist of blocks of all consecutive positive integers written one after another. The fi…
题目大意 有一个无限长的数字序列,其组成为1 1 2 1 2 3 1.......1 2 ... n...,即重复的1~1,1~2....1~n,给你一个\(k\),求第\(k(k<=10^{18})\)个数字是什么. 思路 设\(a[i]\)为该数到达\(i\)的长度,\(b[i]\)为第\(i\)个数那一块的长度,\(\sum b[i]=a[i]\),发现\([10^i,10^{i+1})\)的数长度均为\(i+1\),那么在这一段中\(b[i]\)都是一个等差数列,而计算\(a[i]\)就…
题目: 题意: 已知一个序列: 112123123412345123456123456712345678123456789123456789101234567891011... 求这个序列第k个数是多少. 分析: 首先,我们先来看这样一个问题,让求123456789101112131415...一直到n的长度是多少,我们会怎么求呢?显然,我们会分开求:1-9一组,10-99一组,100-999一组...当然组数不会很多,然后组内其实就是一些位数相等的数的位数的和,那么当然用乘法解决,数清项数就好…
The only difference between the easy and the hard versions is the maximum value of \(k\). You are given an infinite sequence of form "112123123412345-" which consist of blocks of all consecutive positive integers written one after another. The f…
http://acm.hdu.edu.cn/showproblem.php?pid=6304 题意 给出一个数列的定义,a[1]=a[2]=1,a[n]=a[n-a[n-1]]+a[n-1-a[n-2]](n>=3).求前n项和,n<=1e18. 分析 一看就是得打表找规律或推公式的题目. 先把a[i]打出来: 1 1 2 2 3 4 4 4 5 6 6... 乍眼一看每个数字出现的次数有点意思,于是打出每个数出现次数: 数值   1  2  3  4  5  6  7  8  9  10 …
题目 以下思路参考自discuss:http://poj.org/showmessage?message_id=176353 /*我的思路: 1.将长串数分成一个个部分,每个部分是从1到x的无重复的数字序列 2.每个序列比前一个序列多的位数是他的最后一个数的位数,如12345678910比123456789多最后一个10, 即多占了两位,由此可推算出任何一个序列的长度 3.输入位置n,则从1到n查找,每次位置移动一个序列的长度,如果第j个加上序列长度超过n,则输出j这个整数的从个位数第j-n+1…
一眼望去不会. 考虑问题中的\(f(i,j)=|\sum_{p=i}^{j}​a_p​ |\)的实际意义. 其实就是前缀和相减的绝对值. \(f(i,j)=|\ sum[j]-sum[i-1]\ |\) \(f(i,j)=max(sum[j]-sum[i-1],sum[i-1]-sum[j])\) 那加上x呢. \(f(i,j)=max[(sum[j]+xj)-(sum[i-1]+x(i-1)),(sum[i-1]+x(i-1))-(sum[j]+xj)]\) \(sum[i]+xi\)联想到直…
题目链接 问题分析 奇奇怪怪的题... 首先思路达成一致,从大到小一步一步确定位置. 我们一边分析,一边讲算法. 112123123412345123456123456712345678123456789123456789101234567891011123456789101112 假设我们现在要找的是这个串中的倒数第二个位置(就是1),我们可以这样做: 首先,我们想象着把串分开,变成 1 12 123 1234 12345 123456 1234567 12345678 123456789 1…
题意: 一个序列有n个数,有一种操作,你可以选一个数x,使这个序列中等于x的数都移到序列头或尾. 问最少几次操作后,可以使这个序列非降序. 思路: (以下说bi移动到哪里,其实就是指a1……an中等于bi的数移动到哪里) 设这个序列为a1……an,排序并去重后为b1……bm ,如果bi要移到开头,那么bi,bi-1,……,b1肯定要依次移到开头,移到尾部也是同理. 也就是说,最后就是bl……br不需要移动,而r-l越大越好,就是不需要移动的这连续的一段越长越好. 移动到头部和尾部的那些最后一定符…
题意:给你一个模式串\(t\),现在要在主串\(s\)中删除多个子串,使得得到的\(s\)的子序列依然包含\(t\),问能删除的最长子串长度. 题解:首先,我们不难想到,我们可以选择\(s\)头部到最右边的子序列的头部和最左边的子序列的尾部到\(s\)的尾部这两个子串,除去这两个子串,我们要找的最大子串一定在子序列的头部到尾部中,即子序列中两个相邻字符位置的间隔,那么很显然,我们想让相邻的字符之间相隔最大,所以问题也就转化成了:求模式串的相邻字符在主串中的最大间隔长度,最优的情况一定是最左的子序…
考虑\(D1\)的\(O(n^2)\),我们直接进行组合处理. 考虑在\(p\)这个位置,左边有\(l\)个(,右边有\(r\)个),左边有\(l\)个问号,右边有\(r\)个问号. 这个位置的贡献为: \(\sum_{i = 0} ^ x (l+i)\binom{x}{i}\binom{y}{l + i - r}\) 考虑我们拆项. \(l\sum_{i = 0} ^ x\binom{x}{i}\binom{y}{l + i - r} + \sum_{i = 0} ^ x i\binom{x}…
考虑在一个确定的括号序列中,我们可以枚举中间位置,按左右最长延伸出去的答案计算. 我们很自然的思考,我们直接维护左右两边,在删除一些字符后能够延伸的最长长度. 我们设\(f_{i,j}\)为\(i\)点合法删除向左延伸的最大长度. \( f_{i,j} = \left\{ \begin{aligned} &f_{i - 1,j} (a[i] = ')'\ )\\ &f_{i - 1,j - 1}(a[i] = ')'\ )\\ &f_{i - 1,j} + f_{i - 1 ,j…
Over the years, I have collected, modified, adapted, adopted or created a number of software packages in FORTRAN. You might be able to use one of these libraries, or a routine or two from a library. The packages are at different levels of completion.…
  MRIcro tutorial 参考网址:http://www.mccauslandcenter.sc.edu/mricro/mricron/ http://www.cabiatl.com/mricro/mricro/mricro.html This guide gives is a brief description of how you can use MRIcro and SPM to work with patient scans. For the MRIcro manual and…
A. Beautiful String (暴力) 题目链接 题目大意: 给定一个字符串,只有 \(?a\ b\ c\ ?\) ,问是否存在一种将所有的 \(?\) 替换成 \(a\ b\ c\) ,使得任意相邻的字符不同的方法. 大致思路: 其实可以发现问号都可以通过枚举使得其合法,若出现不合法必然除去问好已经不合法,暴力枚举即可. 代码: 点击展开代码 #include<bits/stdc++.h> using namespace std; const int N=1e5+10; char…
http://www.intel.com/content/www/us/en/processors/processor-numbers.html About Intel® Processor Numbers The processor number is one of several factors, along with processor brand, specific system configurations, and system-level benchmarks, to be con…
昨天做了一个Oracle PL/SQL 相关的测试,其中有一道这样的题目:   下列那些是Oracle的伪列(ACD)  A.ROWID   B.ROW_NUMBER()  C.LEVEL  D.ROWNUM  E.COLUMN   虽然我坚持认为Oracle的技术是用来实际应用的,而非用于进行类似于出题,但是作为学生,考试必须是一个提升自己细节把控的最好途径.   那么什么是Oracle的伪列呢?寻遍能找到的中文资料,并没有对Oracle所谓的伪列有明确的解释,最终在Oracle官方文档的Or…
EAPOL 协议 一.基本概念 EAPOL 的全称为 Extensible Authentication Protocol Over LAN,即 EAP Over Lan,也即基于局域网的扩展认证协议.EAP是一个普遍使用的认证机制,它常被用于无线网络或点到点的连接中.EAP不仅可以用于无线局域网,而且可以用于有线局域网.EAP是一个认证框架,不是一个特殊的认证机制.EAP提供一些公共的功能,并且允许协商所希望的认证机制.这些机制被叫做EAP方法,现在大约有40种不同的方法. 二.EAP的认证过…
在前面两篇文章中,我详细介绍了基本事件系统的实现,包括事件派发和订阅.通过事件处理器执行上下文来解决对象生命周期问题,以及一个基于RabbitMQ的事件总线的实现.接下来对于事件驱动型架构的讨论,就需要结合一个实际的架构案例来进行分析.在领域驱动设计的讨论范畴,CQRS架构本身就是事件驱动的,因此,我打算首先介绍一下CQRS架构下相关部分的实现,然后再继续讨论事件驱动型架构实现的具体问题. 当然,CQRS架构本身的实现也是根据实际情况的不同,需要具体问题具体分析的,不仅如此,CQRS架构的实现也…
C - Chocolate Bar 题面 There is a bar of chocolate with a height of H blocks and a width of W blocks. Snuke is dividing this bar into exactly three pieces. He can only cut the bar along borders of blocks, and the shape of each piece must be a rectangle…
本打算接下来分析version相关的概念,但是在准备的过程中看到了VersionSet的table_cache_这个变量才想起还有这样一个模块尚未分析,经过权衡觉得leveldb的version相对Cache来说相对复杂,而且version虽然对整个leveldb来说实现上跟其他功能十分紧密,但是从概念上来说却相对弱很多,有点感觉是附加的功能的感觉.所以从介绍系统首先应该注意的是整个系统概念的完整性的角度说还是先分析Cache相关的功能. 我们先来看Cache的基本框架结构数据: struct…
#接上一篇 这一篇讲一下持久化需要表 batch_job_execution, batch_job_execution_context, batch_job_execution_params, batch_job_execution_seq, batch_job_instance, batch_job_seq, batch_step_execution, batch_step_execution_context, batch_step_execution_seq _seq结尾的三张表,维护bat…
Lecture notes of Mathematical analysis Preliminary theory Teaching purpose: Mathematical analysis is a watershed between high school and university. Its core is the thought of limit. Before introducing the concept of limit, let's first review the kno…
NET Core Web API下事件驱动型架构在前面两篇文章中,我详细介绍了基本事件系统的实现,包括事件派发和订阅.通过事件处理器执行上下文来解决对象生命周期问题,以及一个基于RabbitMQ的事件总线的实现.接下来对于事件驱动型架构的讨论,就需要结合一个实际的架构案例来进行分析.在领域驱动设计的讨论范畴,CQRS架构本身就是事件驱动的,因此,我打算首先介绍一下CQRS架构下相关部分的实现,然后再继续讨论事件驱动型架构实现的具体问题. 当然,CQRS架构本身的实现也是根据实际情况的不同,需要具…
Chapter2 Numerical sequence and function Cartesian product set If S and T are sets,then the cartesian product set S×T is formed by taking all ordered pairs (p,q) where p∈S and q∈T. Relations,functions Any subject f of the cartesian product S×T is cal…
Let N be a positive integer. There is a numerical sequence of length 3N, a=(a1,a2,…,a3N). Snuke is constructing a new sequence of length 2N, a', by removing exactly N elements from a without changing the order of the remaining elements. Here, the sco…
D - 3N Numbers Time limit : 2sec / Memory limit : 256MB Score : 500 points Problem Statement Let N be a positive integer. There is a numerical sequence of length 3N, a=(a1,a2,…,a3N). Snuke is constructing a new sequence of length 2N, a', by removing…