随笔分类 - 数学—数论
摘要:题意: 对于一个数组,可以删除当且仅当,删除后这个位置后面的数将向前平移。现在给定和,问有多少个长度不超过,元素不超过的数组,存在不止一种的清空方式。 考虑长度固定为时的答案。正难则反,可以求出总数量然后减去只有一种
阅读全文
摘要:不算很难的大模拟,考试的时候没做血亏。。不知道代码哪里有问题一直是90分,希望有大佬指出代码哪里有问题QAQ 首先s = -1的情况很容易,维护一个变量mode表示当前模式,直接根据题意模拟即可。关键在于校验码。仔细观察这实际上就是一个多项式除法,用去除得到的余式加个负号
阅读全文
摘要:A. Era 维护一个新数组的末尾位置变量pos,遍历的时候不断更新即可。 #include <iostream> #include <vector> #include <algorithm> #include <cstring> #include <map> #include <set> #def
阅读全文
摘要:链接:https://ac.nowcoder.com/acm/contest/11216/G 来源:牛客网 题目描述 想去实现宏大的梦想 向着那遥不可及的地方 想在那一片纯白的世界 留下我最初的脚印 在世界的终端 太阳在永不停息地运转 南风终将吹过小岛 轻抚我的柔发 想去实现心底小小的梦 ——《ハル
阅读全文
摘要:题目描述 两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止。可是它们出发之前忘记了一件很重要的事情,既没有问清楚对方的特征,也没有约定见面的具体位置。不过青蛙们都是很乐观的,它们觉得只要一直朝着某个方向跳下去,
阅读全文
摘要:Problem Description Alice and Bob are playing a game. They take turns to operate. There are n numbers, a1 , a2 , ... , an. Every time, the player play
阅读全文
摘要:链接:https://ac.nowcoder.com/acm/contest/11254/E 来源:牛客网 题目描述 Given n, count the number of pairs of positive integers (x, y), such that xy+1∣x2+y2,1≤x≤y≤
阅读全文
摘要:问题描述 X 校最近打算美化一下校园环境。前段时间因为修地铁,X 校大门外种的行道树全部都被移走了。现在 X 校打算重新再种一些树,为校园增添一抹绿意。 X 校大门外的道路是东西走向的,我们可以将其看成一条数轴。在这条数轴上有 n 个障碍物,例如电线杆之类的。虽然障碍物会影响树的生长,但是障碍物不一
阅读全文
摘要:随便VP了一下大概是四题的样子 B. Build Roads 链接:https://ac.nowcoder.com/acm/contest/15600/B 来源:牛客网 题目描述 In the cat country, there are nnn cities. The cat country ki
阅读全文
摘要:With the rapid development of society, the demand for high-precision clocks is constantly rising. Recently, the China Clock Production Company is deve
阅读全文
摘要:Alduhmellah and Behlah both like large numbers, lots of numbers and lots of large numbers. They also like to do calculations on those numbers. One day
阅读全文
摘要:ABC Conjecture Time limit: 3 seconds Figure 1: Shinichi Mochizuki The ABC conjecture (also known as the Oesterle–Masser conjec- ´ ture) is a famous co
阅读全文
摘要:Little Q is very sleepy, and he really needs some coffee to make him awake. At this time, Little L brings a pot to Little Q, and he states the pot as
阅读全文
摘要:You are given three integers a, 𝑏b and c. Find two positive integers x and y (x>0, y>0) such that: the decimal representation of x without leading ze
阅读全文
摘要:链接:https://ac.nowcoder.com/acm/contest/1033/B 来源:牛客网 题目描述 给定一个长度为N的数列A,以及M条指令,每条指令可能是以下两种之一: 1、“C l r d”,表示把 A[l],A[l+1],…,A[r] 都加上 d。 2、“Q l r”,表示询问
阅读全文
摘要:链接:https://ac.nowcoder.com/acm/contest/9984/J 来源:牛客网 众所周知,邬澄瑶正在学习欧几里得算法。 现在她已经可以轻松求解 gcd(x1,⋯,xn),并为此洋洋得意。为了整治狂妄自大的邬澄瑶,她的室友把这个式子甩给了他
阅读全文
摘要:https://ac.nowcoder.com/acm/contest/9981#question A. 串 考虑先搞出来一个串然后逐渐添加。设dp[i]为长度为i的含有us子串的串的个数,则当dp[i - 1]已经求出来的情况下,第i个位置: 前面已经有us,第i个位置随便添加 dp[i] +=
阅读全文
摘要:A. 签到,因为是等概率,且红色数字两两不同,黑色数字两两不同,故只需要看第一张即可。然后就是枚举每张卡片比较上面的两个数字。 #include <iostream> using namespace std; int main() { freopen("data.txt", "r", stdin);
阅读全文