Problem G. Generators Input file: generators.in Output file: generators.outLittle Roman is studying linear congruential generators — one of the oldest and best known pseudorandom number generator algorithms. Linear congruential generator (LCG) starts w…
To become the king of Codeforces, Kuroni has to solve the following problem. He is given n numbers a1,a2,-,an. Help Kuroni to calculate ∏1≤i<j≤n|ai−aj|. As result can be very big, output it modulo m. If you are not familiar with short notation, ∏1≤i<…
描述 http://poj.org/problem?id=1065 木棍有重量 w 和长度 l 两种属性,要使 l 和 w 同时单调不降,否则切割机器就要停一次,问最少停多少次(开始时停一次). Wooden Sticks Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 21277 Accepted: 9030 Description There is a pile of n wooden sticks. The le…
UVA 10620 - A Flea on a Chessboard 题目链接 题意:给定一个跳蚤位置和移动方向.如今在一个国际象棋棋盘上,左下角为黑格,一个格子为s*s,推断是否能移动到白格子.问要移动多少次才干到白格,边界不算白格. 思路:利用鸽笼原理落在黑格子和边界上的一共同拥有(s + 1)^2个点,也就是说.假设形成循环,周期肯定在这之内.所以能够不断去模拟跳格子,直到踩到白格,或者踩到之前落到过的黑格就结束 只是事实上还有更优的方法,由于跳蚤跳跃路径为直线,观察下能够发现假设能够到白…