随笔分类 -  数学—数论

摘要:题意: 对于一个数组a,可以删除a[i]当且仅当gcd(i,a[i])=1,删除后这个位置后面的数将向前平移。现在给定nm,问有多少个长度不超过n,元素不超过m的数组,存在不止一种的清空方式。 考虑长度固定为n时的答案。正难则反,可以求出总数量然后减去只有一种 阅读全文
posted @ 2022-10-21 23:07 脂环 阅读(54) 评论(0) 推荐(0) 编辑
摘要:不算很难的大模拟,考试的时候没做血亏。。不知道代码哪里有问题一直是90分,希望有大佬指出代码哪里有问题QAQ 首先s = -1的情况很容易,维护一个变量mode表示当前模式,直接根据题意模拟即可。关键在于校验码。仔细观察这实际上就是一个多项式除法,用g(x)去除xkd(x)得到的余式加个负号 阅读全文
posted @ 2022-02-22 19:20 脂环 阅读(391) 评论(0) 推荐(0) 编辑
摘要:A. Era 维护一个新数组的末尾位置变量pos,遍历的时候不断更新即可。 #include <iostream> #include <vector> #include <algorithm> #include <cstring> #include <map> #include <set> #def 阅读全文
posted @ 2021-10-31 00:40 脂环 阅读(154) 评论(2) 推荐(0) 编辑
摘要:链接:https://ac.nowcoder.com/acm/contest/11216/G 来源:牛客网 题目描述 想去实现宏大的梦想 向着那遥不可及的地方 想在那一片纯白的世界 留下我最初的脚印 在世界的终端 太阳在永不停息地运转 南风终将吹过小岛 轻抚我的柔发 想去实现心底小小的梦 ——《ハル 阅读全文
posted @ 2021-10-23 16:49 脂环 阅读(54) 评论(0) 推荐(0) 编辑
摘要:题目描述 两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止。可是它们出发之前忘记了一件很重要的事情,既没有问清楚对方的特征,也没有约定见面的具体位置。不过青蛙们都是很乐观的,它们觉得只要一直朝着某个方向跳下去, 阅读全文
posted @ 2021-10-04 23:09 脂环 阅读(79) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2021-08-12 17:45 脂环 阅读(218) 评论(0) 推荐(0) 编辑
摘要:链接: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≤ 阅读全文
posted @ 2021-07-25 00:23 脂环 阅读(502) 评论(2) 推荐(3) 编辑
摘要:问题描述 X 校最近打算美化一下校园环境。前段时间因为修地铁,X 校大门外种的行道树全部都被移走了。现在 X 校打算重新再种一些树,为校园增添一抹绿意。 X 校大门外的道路是东西走向的,我们可以将其看成一条数轴。在这条数轴上有 n 个障碍物,例如电线杆之类的。虽然障碍物会影响树的生长,但是障碍物不一 阅读全文
posted @ 2021-07-16 14:43 脂环 阅读(3750) 评论(4) 推荐(4) 编辑
摘要:随便VP了一下大概是四题的样子 B. Build Roads 链接:https://ac.nowcoder.com/acm/contest/15600/B 来源:牛客网 题目描述 In the cat country, there are nnn cities. The cat country ki 阅读全文
posted @ 2021-05-13 19:54 脂环 阅读(327) 评论(0) 推荐(0) 编辑
摘要:With the rapid development of society, the demand for high-precision clocks is constantly rising. Recently, the China Clock Production Company is deve 阅读全文
posted @ 2021-05-12 17:02 脂环 阅读(120) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2021-05-11 21:14 脂环 阅读(118) 评论(0) 推荐(0) 编辑
摘要:有公式: num=xp+xp2+xp3+.... pk相当于1到n中$p 阅读全文
posted @ 2021-05-11 19:41 脂环 阅读(470) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2021-05-11 17:20 脂环 阅读(144) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2021-05-08 20:41 脂环 阅读(70) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2021-04-14 14:27 脂环 阅读(132) 评论(0) 推荐(0) 编辑
摘要:链接: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”,表示询问 阅读全文
posted @ 2021-02-25 17:01 脂环 阅读(180) 评论(0) 推荐(0) 编辑
摘要:链接:https://ac.nowcoder.com/acm/contest/9984/J 来源:牛客网 众所周知,邬澄瑶正在学习欧几里得算法。 现在她已经可以轻松求解 gcd(x1,⋯,xn),并为此洋洋得意。为了整治狂妄自大的邬澄瑶,她的室友把gcd(x1,,x)这个式子甩给了他 阅读全文
posted @ 2021-02-19 19:37 脂环 阅读(226) 评论(0) 推荐(1) 编辑
摘要:设a=p_1^p_2^p_3^... b = p_1^p_2^p_3^,联想唯一分解定理,则lcm(a,b)=p1max(a1,b1)p2max(a2,b2)p3max(a3,b3)... 阅读全文
posted @ 2021-02-07 23:47 脂环 阅读(78) 评论(0) 推荐(0) 编辑
摘要:https://ac.nowcoder.com/acm/contest/9981#question A. 串 考虑先搞出来一个串然后逐渐添加。设dp[i]为长度为i的含有us子串的串的个数,则当dp[i - 1]已经求出来的情况下,第i个位置: 前面已经有us,第i个位置随便添加 dp[i] += 阅读全文
posted @ 2021-02-07 23:44 脂环 阅读(108) 评论(0) 推荐(0) 编辑
摘要:A. 签到,因为是等概率,且红色数字两两不同,黑色数字两两不同,故只需要看第一张即可。然后就是枚举每张卡片比较上面的两个数字。 #include <iostream> using namespace std; int main() { freopen("data.txt", "r", stdin); 阅读全文
posted @ 2020-12-20 00:22 脂环 阅读(117) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示
主题色彩