CodeForces Gym101161D Find C
来源:互联网 发布:王诺诺知乎女神扒皮 编辑:程序博客网 时间:2024/05/16 17:29
#include<bits/stdc++.h>using namespace std;#define fi first#define se second#define pb push_back#define lson o<<1#define rson o<<1|1#define CLR(A, X) memset(A, X, sizeof(A))#define bitcount(X) __builtin_popcountll(X)typedef long long LL;typedef pair<int, int> PII;const double eps = 1e-10;const double PI = acos(-1.0);const LL MOD = 1e9+7;const auto INF = 0x3f3f3f3f;int dcmp(double x) { if(fabs(x) < eps) return 0; return x<0?-1:1; }const int MAXN = 1e5+5;void exgcd(LL a, LL b, LL &d, LL &x, LL &y) { if(!b) { d = a; x = 1; y = 0; } else { exgcd(b, a%b, d, y, x); y -= x*(a/b); }}int main() { int X; scanf("%d", &X); while(X--) { LL ax, ay, bx, by, x, y, g; int k; scanf("%lld%lld%lld%lld%d", &ax, &ay, &bx, &by, &k); LL a = by-ay, b = ax-bx; exgcd(a, b, g, x, y); a /= g, b /= g; while(k--) { x += b; y -= a; printf("%lld %lld\n", ax+x, ay+y); } } return 0;}
阅读全文
0 0
- CodeForces Gym101161D Find C
- codeforces C. Find Maximum
- CodeForces 160C Find Pair
- CodeForces 805C Find Amir
- Codeforces 805C Find Amir
- Codeforces 353C Find Maximum【贪心】
- Codeforces Round #411 C. Find Amir
- Codeforces 160C Find Pair【思维+排序】
- CodeForces 160C Find Pair(思维)
- Codeforces #205 Div.2 Problem C - Find Maximum
- Codeforces Round #205 (Div. 2) C. Find Maximum
- Codeforces Round #205 (Div. 2) / 353C Find Maximum (贪心)
- Codeforces Round #411 (Div. 2) C. Find Amir
- Codeforces Round #411(Div. 2)C. Find Amir【思维】
- Codeforces Round #411 C.Find Amir (思维题)
- Codeforces-809C Find a car(分治)
- [数位DP] Codeforces 809C. Find a car
- [数位DP] Codeforces #809C. Find a car
- Linux (CentOS)安装VNC+XFCE可视化桌面环境 附安装FireFox浏览器
- EDID 解析
- unity5.6.3发布Android
- 基于quartz-2.1.3.jar 的quartz调度表达式
- Linux 文件的解压和压缩 —— 文件类型
- CodeForces Gym101161D Find C
- 创建文件夹(文件)之 mkdir、mkdirs、createNewFile
- lsof命令详解
- PNG格式(中文)
- 在Maven项目中添加Oracle的驱动及配置POM文档
- C#中虚方法和抽象类的对比
- javascript实现日期按月份加减
- 查看Linux系统版本信息
- springmvc业务流程框架