Line(扩展欧几里得)】的更多相关文章

题意:本题给出一个直线,推断是否有整数点在这条直线上: 分析:本题最重要的是在给出的直线是不是平行于坐标轴,即A是不是为0或B是不是为0..此外.本题另一点就是C输入之后要取其相反数,才干进行扩展欧几里得求解 关于扩展欧几里得详见:http://blog.csdn.net/qq_27599517/article/details/50888092. 代码例如以下: #include <set> #include <map> #include <stack> #includ…
Line Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u Submit Status Description A line on the plane is described by an equation Ax + By + C = 0. You are to find any point on this line, whose coordinates are integer numbers…
C Looooops Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 23700   Accepted: 6550 Description A Compiler Mystery: We are given a C-language style for loop of type for (variable = A; variable != B; variable += C) statement; I.e., a loop w…
Root Time Limit: 30000/15000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 34    Accepted Submission(s): 6 Problem Description Given a number sum(1≤sum≤100000000),we have m queries which contains a pair (xi,yi) a…
Marbles Input: standard input Output: standard output I have some (say, n) marbles (small glass balls) and I am going to buy some boxes to store them. The boxes are of two types: Type 1: each box costs c1 Taka and can hold exactly n1 marbles Type 2:…
Invoker Problem Description On of Vance's favourite hero is Invoker, Kael. As many people knows Kael can control the elements and combine them to invoke a powerful skill. Vance like Kael very much so he changes the map to make Kael more powerful.  In…
Root                                                                          Time Limit: 30000/15000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)                                                                                    …
L. Knights without Fear and Reproach time limit per test 2.0 s memory limit per test 256 MB input standard input output standard output They were all dead. The final lunge was an exclamation mark to everything that had led to this point. I wiped my s…
http://codeforces.com/contest/724/problem/C 题目大意: 在一个n*m的盒子里,从(0,0)射出一条每秒位移为(1,1)的射线,遵从反射定律,给出k个点,求射线分别第一次经过这些点的时间. 解法一: (模拟) 射线不管怎么反射,都是和水平方向成45°角的,也就是说每一段射线上的点,横坐标和纵坐标的和或者差相等. 把每一个点放入它所对应的对角线里,然后模拟射线的路径就好. 代码: #include <iostream> #include <cstd…
题目大意:有3个整数 x[1], a, b 满足递推式x[i]=(a*x[i-1]+b)mod 10001.由这个递推式计算出了长度为2T的数列,现在要求输入x[1],x[3],......x[2T-1], 输出x[2],x[4]......x[2T]. T<=100,0<=x<=10000. 如果有多种可能的输出,任意输出一个结果即可. 由于a和b都小于等于10000,直接枚举a和b暴力可以过.但是有没有更快的方法呢? 首先令递推式的i=2,那么x[2]=(a*x[1]+b)mod 1…