Crack Mathmen TimeLimit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 Since mathmen take security very seriously, theycommunicate in encrypted messages. They cipher their texts in this way: for everycharacther c in the message, they replace c with…
Binomial Coeffcients TimeLimit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 输入 输出 示例输入 1 1 10 2 954 723 示例输出 /******************* 组合数学 组合数 用 递推  :组合数公式 C[n][m] = C[n-1][m-1] + C[n-1][m] ************************/ Code: #include <iostream> #include…
题目描述 We know thatIvan gives Saya three problems to solve (Problem F), and this is the firstproblem. "We need a programmer to help us for some projects. If you show us that youor one of your friends is able to program, you can pass the first hurdle. I…
Crack Mathmen Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述  Since mathmen take security very seriously, they communicate in encrypted messages. They cipher their texts in this way: for every characther c in the message, they replace c w…
题目描述 We know thatif a phone number A is another phone number B's prefix, B is not able to becalled. For an example, A is 123 while B is 12345, after pressing 123, we callA, and not able to call B. Given N phone numbers, your task is to find whether t…
Description A Swiss-system tournament is a tournament which uses a non-elimination format. The first tournament of this type was a chess tournament in Zurich in 1895, hence the name "Swiss system". The tournament will be held based on following…
Description In mathematics, a square number is an integer that is the square of an integer. In other words, it is the product of some integer with itself. For example, 9 is a square number, since it can be written as 3 * 3. Given an array of distinct…
版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/svitter/article/details/24270265 本文出自:http://blog.csdn.net/svitter.转载请注明出处. 原题:点击打开链接 和晨阳哥一同讨论了一下这个题目= =最终在今晚AC了. 这个题目能够说是RSA加密算法的变种.. 考虑997是素数,那么符合欧拉定理.然后想到费马小定理 m ^ 996 MOD 997 = 1; 由于一般的RSA解密算法都是C^d…
Problem Description Given a prime number C(1≤C≤2×105), and three integers k1, b1, k2 (1≤k1,k2,b1≤109). Please find all pairs (a, b) which satisfied the equation a^(k1⋅n+b1 )+ b^(k2⋅n−k2+1) = 0 (mod C)(n = 1, 2, 3, ...). Input There are multiple test…
题意:两个人轮流说数字,第一个人可以说区间[1~k]中的一个,之后每次每人都可以说一个比前一个人所说数字大一点的数字,相邻两次数字只差在区间[1~k].谁先>=N,谁输.问最后是第一个人赢还是第二个人赢. 分析:必胜策略是这样的,想方设法抢到N-1,这样下一个人必然会>=N. 第一个人抢到N-1的方法,就是先说一个数字与N-1的差是k+1的整数倍. 因为在这之后另一个人无论说几,第一个人只要把数字补齐到与N-1差k+1的整数倍即可. 例如另一个人让数字增加a,那么第一个人则让数字增加k+1-a…
0x00 题目名称 签到 操作内容:   FLAG值: flag{welcome_to_qwb} 0x01 题目名称 Weclome 操作内容: 通过查看文件发现是一个bmp格式的图片文件,然后加上后缀.bmp,如图 将图片放入色道,通过变换得到flag FLAG值: QWB{W3lc0me} 0x02 题目名称 streamgame1操作内容: 密码长度不大,暴力破解得到flag     FLAG值: flag{1110101100001101011} 0x03 题目名称 web签到操作内容:…
题意:给出一个字符串,要从头.尾和中间找出三个完全相等的子串,这些串覆盖的区间互相不能有重叠部分.头.尾的串即为整个字符串的前缀和后缀.问这个相同的子串的最大长度是多少. 分析:利用KMP算法中的next数组.next数组有一个性质,如果next[b]指向a.a<b.那么 以a作为结尾的原串前缀 是 以b作为结尾的原串前缀 的后缀. 那么如果b是原串的最后一位,那么以b结尾的前缀就是原串,则a结尾的前缀与一个原串的后缀相等. 我们既然找到了一个相等的前缀和后缀,只需要再判断中间是否有相同的子串即…
题意:一个数列,给出这个数列中的某些位置的数,给出所有相邻的三个数字的和,数列头和尾处给出相邻两个数字的和.有若干次询问,每次问某一位置的数字的最大值. 分析:设数列为a1-an.首先通过相邻三个数字的和我们可以求出a3,a6,a9……是多少.a3=sum(a1,a2,a3)-sum(a1,a2).a6=sum(a4,a5,a6)-sum(a3,a4,a5).后面依次类推. 推到了数列的最右面,如果恰好知道了an或者a(n-1)中的一个,那么可以通过sum(an,a(n-1))减去它来求得另一个…
题意:给出一个4×4的点阵,连接相邻点可以构成一个九宫格,每个小格边长为1.从没有边的点阵开始,两人轮流向点阵中加边,如果加入的边构成了新的边长为1的小正方形,则加边的人得分.构成几个得几分,最终完成九宫格时,谁的分高谁赢.现在给出两人前若干步的操作,问接下来两人都采取最优策略的情况下,谁赢. 分析:博弈搜索,有人说要加记忆化,我没有加也过了……与赤裸裸的博弈搜索的区别在于对于最终状态,并不是谁无路可走谁输,而是谁分低谁输.注意判断分数相等的情况.在搜索中每个节点要么是必胜态,要么是必败态,可参…
Alice's Print Service Time Limit: 2 Seconds      Memory Limit: 65536 KB Alice is providing print service, while the pricing doesn't seem to be reasonable, so people using her print service found some tricks to save money. For example, the price when…
Collision Time Limit: 2 Seconds      Memory Limit: 65536 KB      Special Judge There's a round medal fixed on an ideal smooth table, Fancy is trying to throw some coins and make them slip towards the medal to collide. There's also a round range which…
题意:驴和老虎,在一个矩阵的两个格子里,有各自的起始方向.两者以相同的速度向前移动,前方不能走时驴总是向右,老虎总是向左.他们不能超出矩阵边界也不能走自己走过的格子(但可以走对方走过的格子).如果不能前进时转向后仍不能前进则永久停止运动,问两者是否相遇(同时出现在同一个格子里,同时出现在格子的边界上不算),若相遇给出相遇坐标. 分析:模拟即可,每次将两者按其规则移动,并判断两者是否在同一个格子里.注意:起始点在同一个格子里也算相遇.转向不算时间,因为题里说二者速度始终相同.本来应该用面向对象的方…
题目大意就是找出n的约数,然后把约数在m进制下展开,各个数位的每一位平方求和,然后按m进制输出. 模拟即可 #include<cstdio> #include<iostream> #include<algorithm> #include<cstring> #include<cmath> #include<queue> #include<map> using namespace std; #define MOD 100000…
转载请注明出处,谢谢http://blog.csdn.net/ACM_cxlove?viewmode=contents    by---cxlove 题目:给出N个城市,从1开始需要遍历所有点,选择一些点建立加油站,使得花费最少 这题的特殊性在于他的花费上,2^(i-1) 利用一个非常重要的性质,2^0+2^1+2^2……+2^i<2^(i+1) 所有编号<=i的所有点都建,总花费比建一个还少. 这里就贪心一下,先假设所有点都建,然后依次从编号大的删点,看看能不能遍历整个图 dist[i]表示…
Description BIGZHUGOD and his three friends are playing a game in a triangle ground. The number of BIGZHUGOD is 0, and his three friends are numbered from 1 to 3. Before the game begins, three friends stand on three vertices of triangle in numerical…
表达式求值 时间限制:1000 ms | 内存限制:65535 KB 难度:3   描述 假设表达式定义为:1. 一个十进制的正整数 X 是一个表达式.2. 如果 X 和 Y 是 表达式,则 X+Y, X*Y 也是表达式; *优先级高于+.3. 如果 X 和 Y 是 表达式,则 函数 Smax(X,Y)也是表达式,其值为:先分别求出 X ,Y值的各位数字之和,再从中选最大数.4.如果 X 是 表达式,则 (X)也是表达式. 例如:表达式 12*(2+3)+Smax(333,220+280) 的值…
记第五届山东省ACM程序设计比赛 5月10日上午9点半左右,我们的队伍从学校出发,一个多小时后到达本次比赛的地点-哈尔滨工业大学. 报道,领材料,吃午饭,在哈工大的校园里逛了逛,去主楼的自习室歇息了一会.然后參加下午两点到四点的热身赛.不得不吐槽一下热身赛的题目,第一个题题目的数据范围写的是十的六次方,我们写出来提交怎么也不正确,后来快结束时看讨论板,管理人员说数据范围是十的九次方,无语了.第二个题目无输入,仅仅输出1到20之间的一个随机整数,题目上也明白说了是拼人品的题目,有的队伍"人品比較好…
5.11,5.12两天的济南之旅结束了,我也参加了人生中第一次正式的acm比赛,虽然是以友情队的身份,但是我依旧十分兴奋. 其实一直想写博客来增加自己的能力的,但是一直拖到现在,正赶上老师要求写一份总结报告,所以顺势就写下这个博客了. 训练赛总结:个人训练赛期间,我除了在icpc上做题外,也专门去了洛谷刷一些专题,很幸运,天梯赛时正好出了我正在洛谷刷的搜索裸题,还有stack应用的糖果罐那个题,正好也是那几天我看的紫书的部分,所以确实有一定的好运啊,对寒假里学长们讲的知识的了解逐渐多了,也看到了…
Description Both Saya and Kudo like balloons. One day, they heard that in the central park, there will be thousands of people fly balloons to pattern a big image. They were very interested about this event, and also curious about the image. Since the…
Memory Leak Time Limit: 2000MS Memory limit: 131072K 题目描述 Memory Leak is a well-known kind of bug in C/C++. When a string is longer than expected, it will visit the memory of next array which will cause the issue and leak some information. You can se…
Reversed Words Time Limit: 2000MS Memory limit: 131072K 题目描述 Some aliens are learning English. They have a very strange way in writing that they revered every word in the sentence but keep all the words in common order. For example when they want to…
Triple Nim Time Limit: 2000MS Memory limit: 65536K 题目描述 Alice and Bob are always playing all kinds of Nim games and Alice always goes first. Here is the rule of Nim game: There are some distinct heaps of stones. On each turn, two players should remov…
The Binding of Isaac Time Limit: 2000MS Memory limit: 65536K 题目描述 Ok, now I will introduce this game to you... Isaac is trapped in a maze which has many common rooms- Like this-There are 9 common rooms on the map. And there is only one super-secret r…
Fibonacci Time Limit: 2000MS Memory limit: 131072K 题目描述 Fibonacci numbers are well-known as follow: Now given an integer N, please find out whether N can be represented as the sum of several Fibonacci numbers in such a way that the sum does not inclu…
Julyed Time Limit: 2000MS Memory limit: 65536K 题目描述 Julyed is preparing for her CET-6. She has N words to remember, but there is only M days left. If she can't remember all these words, she won't pass CET-6. If she can't pass CET-6, she will be unhap…