随笔分类 -  ACM-数学

摘要:https://ac.nowcoder.com/acm/contest/5675/C 题意 给出一个树,q次修改,每次修改将第p条边权值修改为w。 回答q+1询问,每次操作可以选择一条链,把这条链上所有边的权值减一,问最少进行多少次操作才能把所有边权全部归零。 题解 考虑每个节点的边进行匹配,如果最 阅读全文
posted @ 2020-09-10 22:34 Artoriax 阅读(211) 评论(0) 推荐(0)
摘要:https://ac.nowcoder.com/acm/contest/5674/E 题意 题解 对于每个质因数分开考虑,计算这个质因数对答案的贡献,先预处理出gcd(x,y)的每个质因数在x中有几个,y中有几个,然后枚举一边a到b,计算较小的次数产生的贡献,直至处理完所有的质因数即可 注意在计算过 阅读全文
posted @ 2020-09-08 16:02 Artoriax 阅读(229) 评论(0) 推荐(0)
摘要:https://ac.nowcoder.com/acm/contest/5673/E 题意 定义$f(n)$为拆分n为$a_1,a_2 \dots a_m$满足相邻两个数差值不能超过1,且最大值和最小值差值为2的拆分个数,T次询问,每次询问$\sum\limits_^r f(i)$ 题解 拆分肯定由 阅读全文
posted @ 2020-09-08 15:39 Artoriax 阅读(158) 评论(0) 推荐(0)
摘要:https://ac.nowcoder.com/acm/contest/5672/H 题意 正整数二元组 Legend Tuple (n, k) 是这样定义的 (1, k) 总是 Legend Tuple 若 (n, k) 是 Legend Tuple, 那么 (n + k, k) 也是 若 (n, 阅读全文
posted @ 2020-09-08 14:02 Artoriax 阅读(156) 评论(0) 推荐(0)
摘要:题意 给出一个长度为n的排列,m次操作,每次操作为$(k,x)$,表示进行x次k-约瑟夫变换 k-约瑟夫变换即:首先把n个元素排列成环,从第一个元素数k个元素,把这个元素删除,并把它放到新排列$P'$中,接着从下一个元素再开始数k个元素,删除,放入,直至没有元素。 题解 首先考虑如何求一个 k-约瑟 阅读全文
posted @ 2020-09-01 15:55 Artoriax 阅读(148) 评论(0) 推荐(0)
摘要:https://ac.nowcoder.com/acm/contest/5668/F 题意 给定a,b,求$\frac-\frac=\fracb$,且d,f小于b,且c,e小于$4\times 10^{12} $ 题解 如果a,b不互质,答案为$a' + 1, b', 1, b'$,其中$a',b' 阅读全文
posted @ 2020-08-31 15:44 Artoriax 阅读(135) 评论(0) 推荐(0)
摘要:Codeforces 1332E Height All the Same Alice has got addicted to a game called Sirtet recently. In Sirtet, player is given an $n \times m$ grid. Initial 阅读全文
posted @ 2020-04-01 14:59 Artoriax 阅读(329) 评论(0) 推荐(0)
摘要:Codeforces 1323D Present Catherine received an array of integers as a gift for March 8. Eventually she grew bored with it, and she started calculated 阅读全文
posted @ 2020-03-26 21:16 Artoriax 阅读(206) 评论(0) 推荐(0)
摘要:Codeforces 1323E Instant Noodles Wu got hungry after an intense training session, and came to a nearby store to buy his favourite instant noodles. Aft 阅读全文
posted @ 2020-03-26 17:39 Artoriax 阅读(249) 评论(0) 推荐(0)
摘要:Codeforces 1327D Infinite Path You are given a colored permutation $p_1, p_2, \dots, p_n$. The i th element of the permutation has color $c_i$. Let's 阅读全文
posted @ 2020-03-25 10:45 Artoriax 阅读(160) 评论(0) 推荐(0)
摘要:题面 Description There are $k$ piles of stones in a circle, numbered from $0$ to $k 1$, where the number of the stones in each pile is $n$ initially. Yo 阅读全文
posted @ 2020-01-30 12:37 Artoriax 阅读(270) 评论(0) 推荐(0)
摘要:题面 Description Give you two arrays $A[0..2^m 1]$ and $B[0..2^m 1]$. Please calculate array $C[0..2^m 1]$: $$ C[k]=\sum_{i~and~j=k}A[i~xor~j] B[i~or~j] 阅读全文
posted @ 2020-01-29 22:45 Artoriax 阅读(127) 评论(0) 推荐(0)
摘要:题面 Description The Brocard Erdös Straus conjecture is that for any integer n 2 , there are positive integers a ≤ b ≤ c ,so that : $$ {4\over n}={1\ove 阅读全文
posted @ 2019-03-22 10:08 Artoriax 阅读(478) 评论(0) 推荐(0)
摘要:题目链接 https://vjudge.net/problem/HDU 4990 题面 Description Read the program below carefully then answer the question. c++ pragma comment(linker, "/STACK: 阅读全文
posted @ 2019-02-14 18:28 Artoriax 阅读(218) 评论(0) 推荐(0)
摘要:CSU "2019" Fleecing the Raffle Description A tremendously exciting raffle is being held, with some tremendously exciting prizes being given out. All y 阅读全文
posted @ 2019-02-04 12:53 Artoriax 阅读(200) 评论(0) 推荐(0)
摘要:CSU "1985" 驱R符 Description 阴阳师中有三中稀有度的式神R,SR,SSR,其中R的稀有度最低,每次抽符,会随机得到一种式神,然而子浩君对R式神已经深恶痛绝。 某天,子浩君突然发现,有一种护身符,叫做驱R符,为什么会驱R?因为很多的R式神有密集恐惧症,而这个符上有很多的交点。 阅读全文
posted @ 2019-02-02 21:02 Artoriax 阅读(166) 评论(0) 推荐(0)
摘要:CSU "2049" 象棋 Description 車是中国象棋中的一种棋子,它能攻击同一行或同一列中没有其他棋子阻隔的棋子。一天,小度在棋盘上摆起了许多車……他想知道,在一共N×M个点的矩形棋盘中摆最多个数的車使其互不攻击的方案数。他经过思考,得出了答案。但他仍不满足,想增加一个条件:对于任何一个 阅读全文
posted @ 2019-02-02 20:44 Artoriax 阅读(160) 评论(0) 推荐(0)
摘要:CSU "1163" 寒衣调 Description 男从戎,女守家。一夜,狼烟四起,男战死沙场。从此一道黄泉,两地离别。最后,女终于在等待中老去逝去。逝去的最后是换尽一生等到的相逢和团圆。 某日两人至奈何桥前,服下孟婆汤。 每滴孟婆汤都有强度不一的药效,设一碗孟婆汤共N滴(0<N<100000), 阅读全文
posted @ 2019-02-02 20:33 Artoriax 阅读(205) 评论(0) 推荐(0)
摘要:CSU "2173" Use FFT Description Bobo computes the product P ( x )⋅ Q ( x )=$c_0 + c_1x + … + c_{n+m}x^{n + m}$ for two polynomials P ( x )=$a_0 + a_1x  阅读全文
posted @ 2019-02-02 20:31 Artoriax 阅读(440) 评论(0) 推荐(0)