UVa 10077 The Stern-Brocot Number System (数学)
来源:互联网 发布:tensorrt tensorflow 编辑:程序博客网 时间:2024/03/29 10:21
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1018
/*0.012s*/#include<cstdio>int a, b, la, lb, ma, mb, ra, rb;inline int cmp(int c, int d){if (a * d < b * c) return -1;else return a * d > b * c;}int main(){ int cmpm;while (scanf("%d%d", &a, &b), a != 1 || b != 1){la = rb = 0, ma = mb = lb = ra = 1;while (true){cmpm = cmp(ma, mb);if (cmpm == 0) break;if (cmpm < 0){putchar('L');ra = ma, rb = mb;}else{putchar('R');la = ma, lb = mb;}ma = la + ra, mb = lb + rb;}putchar(10);}return 0;}
0 0
- UVa 10077 The Stern-Brocot Number System (数学)
- UVa 10077 - The Stern-Brocot Number System
- uva 10077 The Stern-Brocot Number System
- UVA 10077 The Stern-Brocot Number System
- UVa Problem 10077 The Stern-Brocot Number System (Stern-Brocot 代数系统)
- UVa Problem Solution: 10077 - The Stern-Brocot Number System
- 10077 - The Stern-Brocot Number System
- 110507 The Stern-Brocot Number System
- (挑战编程_5_7)The Stern-Brocot Number System
- The Stern-Brocot Number System(排序二叉树)
- Hdu 6209 The Intersection(Stern-Brocot tree+二分)
- hdu 4556 Stern-Brocot
- hdu4556-Stern-Brocot Tree
- hdu4556-Stern-Brocot Tree
- HDU-4556-Stern-Brocot Tree
- hdu 4556 Stern-Brocot Tree
- hdu 4556 Stern-Brocot Tree
- HDOJ 4556 Stern-Brocot Tree
- 一步步安装nginx搭建流媒体服务器
- 将Java的class文件转为EXE文件的八种方法
- sizeof和sizeof(string)的问题
- C++日记——list的erase用法
- 朋友圈热荐:互联网老二逆袭的6大法宝
- UVa 10077 The Stern-Brocot Number System (数学)
- ACM长沙赛区 Goldbach——素数筛
- 解剖C语言---数据类型转换与数据运算集锦
- IOCP模型与网络编程
- 偷懒自责专用贴
- Java桌面程序打包成exe可执行文件
- JSP总结
- 用户数据库未清空导致测试问题解决
- 临界区的LockCount为何小于-1