摘要: 题目描述 在魔法森林,最有名的两个建筑物就是玛格特洛依德邸和雾雨邸。这个问题便是雾雨邸的主人,雾雨魔理沙,在制造以星尘为原料的烟火时遇到的。魔理沙一共想要制造T个烟火。她现在有n种星尘,用第i种材星尘制造一个烟火的花费为ci份星尘。由于同种星尘之间的排斥,每次用第i种星尘制造了一个烟火之后,下一次使 阅读全文
posted @ 2019-07-09 23:45 lglh 阅读(163) 评论(0) 推荐(0) 编辑
摘要: 【数位DP】恨7不成妻 题目描述 单身!依然单身! 吉哥依然单身!DS级码农吉哥依然单身! 所以,他生平最恨情人节,不管是214还是77,他都讨厌! 吉哥观察了214和77这两个数,发现:2+1+4=7 7+7=7*2 77=7*11最终,他发现原来这一切归根到底都是因为和7有关!所以,他现在甚至讨 阅读全文
posted @ 2019-06-29 10:56 lglh 阅读(186) 评论(0) 推荐(0) 编辑
摘要: Source: The 10th Shandong Provincial Collegiate Programming Contest 题解: 因为2^p为偶数,所以a,x的奇偶性相同 1.当a为奇数时,答案始终为1 2.下面讨论a为偶数的情况 因为a为偶数,所以a=2*other,a^x=2^x* 阅读全文
posted @ 2019-06-16 16:01 lglh 阅读(142) 评论(0) 推荐(0) 编辑
摘要: 表达式求值是进行数据处理的最基本操作。请编写程序完成一个简单算术表达式的求值。要求如下: (1) 运算符包括:+、-、*、-、^(乘方)、括号 (2)运算量为数值常量,根据自己的能力可以对运算量做不同的约束,例如1位整数、多位整数、实数等(会有不同的测试用例); 输入:一行,即表达式,以“=”结束。 阅读全文
posted @ 2019-04-30 20:49 lglh 阅读(355) 评论(0) 推荐(0) 编辑
摘要: Alice has a magic array. She suggests that the value of a interval is equal to the sum of the values in the interval, multiplied by the smallest value 阅读全文
posted @ 2019-04-21 21:21 lglh 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 3457: Next K Permutation 题目描述 n 个数有 n! 种全排列情况,对所有排列排序后求第 L 个到第 R 个排列中逆序对数量之和。逆序对定义(摘自 wiki):设 A 为一个有 n 个数字的有序集 (n>1),其中所有数字各不相同。如果存在正整数 i,j 使得 1≤i<j≤n 阅读全文
posted @ 2019-01-16 22:14 lglh 阅读(198) 评论(0) 推荐(0) 编辑
摘要: Hubtown 题目描述 Hubtown is a large Nordic city which is home to n citizens. Every morning, each of its citizens wants to travel to the central hub from w 阅读全文
posted @ 2018-09-11 11:05 lglh 阅读(303) 评论(0) 推荐(0) 编辑
摘要: Compass Card Sales 题目描述 Katla has recently stopped playing the collectible card game Compass. As you might remember, Compass is a game where each card 阅读全文
posted @ 2018-09-07 21:17 lglh 阅读(420) 评论(0) 推荐(0) 编辑
摘要: Ghostbusters 题目描述 The Bureau of Approved Peripherals for Computers (BAPC) is designing a new standard for computer keyboards. With every new norm and 阅读全文
posted @ 2018-09-05 21:13 lglh 阅读(190) 评论(0) 推荐(0) 编辑
摘要: Annual Congress of MUD 题目描述 Multiuser dungeon games, also called MUD games, are real-time virtual-world multiplayer games that are usually played onli 阅读全文
posted @ 2018-09-04 23:22 lglh 阅读(175) 评论(0) 推荐(0) 编辑