11 2018 档案
摘要: 原题:2406 -- Power Strings 题解:找最短循环节,定义:nxt[i] 为 1-i的最长相同前后缀长度,循环节长度为n-nxt[n] //#include<bits/stdc++.h> #include<cstdio> #include<cstring> #define reg
阅读全文
摘要:题目:https://www.luogu.org/problemnew/show/P50202 4 3 9 10 6 5 11 29 13 19 17 题解:观察 样例 显然 3可以把6代替,这样就转换成如果这个数可以被比他小的数凑出来这个数的就会被替代。我们考虑排序...
阅读全文
摘要:题目:https://www.luogu.org/problemnew/show/P5019今年noip考了一道原题:在考场上我想了暴力的方法:这题暴力可以过 #include#include#include#includeusing namespace std;co...
阅读全文
摘要:原题链接:http://poj.org/problem?id=1845题目大意:求的因子和题解:对于所有的因子和则有:观察,显然是等差数列求和所以:由于除法求模可以用费马小定理求逆元:要注意当(pk-1+M)%M==0时要单独处理相当于 pk==1 #include#...
阅读全文
摘要:题目描述【问题描述】Hanks 博士是BT (Bio-Tech,生物技术) 领域的知名专家,他的儿子名叫Hankson。现在,刚刚放学回家的Hankson 正在思考一个有趣的问题。今天在课堂上,老师讲解了如何求两个正整数c1 和c2 的最大公约数和最小公倍数。现在Ha...
阅读全文
摘要:题目描述对于刚上大学的牛牛来说,他面临的第一个问题是如何根据实际情况申请合适的课程。在可以选择的课程中,有 2n2n2n 节课程安排在 nnn 个时间段上。在第 iii(1≤i≤n1 \leq i \leq n1≤i≤n)个时间段上,两节内容相同的课程同时在不同的地点...
阅读全文
摘要:公元 2044 年,人类进入了宇宙纪元。L 国有 n个星球,还有 n-1条双向航道,每条航道建立在两个星球之间,这 n-1 条 航道连通了 L 国的所有星球。小 P 掌管一家物流公司,该公司有很多个运输计划,每个运输计划形如:有一艘物 流飞船需要从 ui 号星球沿最快...
阅读全文
摘要:Disclaimer: there are lots of untranslateable puns in the Russian version of the statement, so there is one more reason for you to lea...
阅读全文
摘要:You are given nn segments on a coordinate line; each endpoint of every segment has integer coordinates. Some segments can degenerate t...
阅读全文
摘要:The sequence of integers a1,a2,…,aka1,a2,…,ak is called a good array if a1=k−1a1=k−1 and a1>0a1>0 . For example, the sequences [3,−1,4...
阅读全文
摘要:E. We Need More Bossestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYour frien...
阅读全文
摘要:time limit per test3 secondsmemory limit per test768 megabytesYou are given an array aa consisting of nn integers, and qq queries to ...
阅读全文