随笔分类 - 数学相关
摘要:分析:码死我了这道题...... 第一次用矩阵树定理+高斯消元做题. O(n^3)可以跑过前50%的点. 对于k = 1的点,直接输出1即可.关键是有一个取模操作...... 一开始我用double存答案,因为最后要取绝对值,取模的话不好弄,干脆用double就能不取模了. 打完之后要存到long
阅读全文
摘要:4714: 旋转排列 Description Input 输入仅有一行,包含一个整数n,1≤n≤500000 输入仅有一行,包含一个整数n,1≤n≤500000 Output 输出一行,包含一个整数,代表答案。 输出一行,包含一个整数,代表答案。 Sample Input 4 Sample Outp
阅读全文
摘要:3028: 食物 Description 明明这次又要出去旅游了,和上次不同的是,他这次要去宇宙探险!我们暂且不讨论他有多么NC,他又幻想了他应 该带一些什么东西。理所当然的,你当然要帮他计算携带N件物品的方案数。他这次又准备带一些受欢迎的食物, 如:蜜桃多啦,鸡块啦,承德汉堡等等当然,他又有一些稀
阅读全文
摘要:4872: [Shoi2017]分手是祝愿 Description Zeit und Raum trennen dich und mich. 时空将你我分开。B 君在玩一个游戏,这个游戏由 n 个灯和 n 个开关组成,给定这 n 个灯的初始状态,下标为 从 1 到 n 的正整数。每个灯有两个状态亮和
阅读全文
摘要:4869: [Shoi2017]相逢是问候 Description Informatikverbindetdichundmich. 信息将你我连结。B君希望以维护一个长度为n的数组,这个数组的下标为从1到n的正整数。一共有m个操作,可以 分为两种:0 l r表示将第l个到第r个数(al,al+1,.
阅读全文
摘要:4827: [Hnoi2017]礼物 Description 我的室友最近喜欢上了一个可爱的小女生。马上就要到她的生日了,他决定买一对情侣手 环,一个留给自己,一 个送给她。每个手环上各有 n 个装饰物,并且每个装饰物都有一定的亮度。但是在她生日的前一天,我的室友突 然发现他好像拿错了一个手环,而且
阅读全文
摘要:2226: [Spoj 5971] LCMSum Description Given n, calculate the sum LCM(1,n) + LCM(2,n) + .. + LCM(n,n), where LCM(i,n) denotes the Least Common Multiple
阅读全文
摘要:3091: 城市旅行 Description Input Output Sample Input 4 5 1 3 2 5 1 2 1 3 2 4 4 2 4 1 2 4 2 3 4 3 1 4 1 4 1 4 Sample Output 16/3 6/1 HINT 对于所有数据满足 1<=N<=50
阅读全文
摘要:C. Save Energy! time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output C. Save Energy! time limi
阅读全文
摘要:E. Maximize! time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output You are given a multiset S
阅读全文
摘要:F. Divisibility time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output F. Divisibility time limi
阅读全文
摘要:C. Constructing Tests time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Let's denote a m-fr
阅读全文
摘要:E. Team Work time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You have a team of N people
阅读全文
摘要:D. A Determined Cleanup time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output In order to put a
阅读全文
摘要:The only survival Time Limit: 40000/20000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 255 Accepted Submission(s):
阅读全文
摘要:2962: 序列操作 Description 有一个长度为n的序列,有三个操作1.I a b c表示将[a,b]这一段区间的元素集体增加c,2.R a b表示将[a,b]区间内所有元素变成相反数,3.Q a b c表示询问[a,b]这一段区间中选择c个数相乘的所有方案的和mod 19940417的值
阅读全文
摘要:1043: [HAOI2008]下落的圆盘 Description 有n个圆盘从天而降,后面落下的可以盖住前面的。求最后形成的封闭区域的周长。看下面这副图, 所有的红色线条的总长度即为所求. 有n个圆盘从天而降,后面落下的可以盖住前面的。求最后形成的封闭区域的周长。看下面这副图, 所有的红色线条的总
阅读全文
摘要:Pipe Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 11421 Accepted: 3567 Description The GX Light Pipeline Company started to prepare bent
阅读全文
摘要:Intersecting Lines Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 17149 Accepted: 7373 Description We all know that a pair of distinct poi
阅读全文
摘要:Decrypt Messages Time Limit: 8000/4000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 657 Accepted Submission(s): 158
阅读全文