Continued Fraction(https://acs.jxnu.edu.cn/problem/ICPCJX2021B)
描述:
A continued fraction is an expression of the form:
a0+1a1+1a2+1⋱+1ana0+1a1+1a2+1⋱+1an
where a0,a1,…,ana0,a1,…,an are nonnegative integers.
Given a fraction xyxy(x,yx,y are positive integers), please expand it into a continued fraction.
输入:
The first line contains an integer T(1≤T≤103)T(1≤T≤103), denoting the number of test cases.
The only line of each test case contains two integers x,y(1≤x,y≤109)x,y(1≤x,y≤109), denoting a fraction xyxy. It's guaranteed that gcd(x,y)=1gcd(x,y)=1.
输出:
For each test case, output one line: first an integer nn denoting the height of the continued fraction, then n+1n+1 integers denoting a0,…,ana0,…,an. Your solution should gurarantee that 0≤n≤1000,0≤ai≤1090≤n≤1000,0≤ai≤109.
If there are multiple valid solutions, you only need to output one of them.
翻译:连分数有一下形式,其中a0,a1...an为非负整数.给定一个分数x/y(x,y都为正整数),将他们以连分数的形式表示.
输入:第一行为一个整数T(1<=T<=10E3),代表测试样例数.每个测试样例一行,两个整数x,y(1<=x,y<=10E9).代表一个分数x/y,并且保证x和y最大公约数为1.
输出:每个测试样例一行,第一个整数n代表的连分数的长度.然后n+1个整数标记为a0...an你的方案应该保证0<=n<=1000,0<=ai<=10E9.
如果有多种解决方案,你只需要输出其中一个
Continued Fraction(https://acs.jxnu.edu.cn/problem/ICPCJX2021B)相关推荐
- Stone Ocean(https://acs.jxnu.edu.cn/problem/GYM103495E)
2022寒假翻译07 石之海 4000ms 0k 描述: 在JoJo的世界里,有些人能够将他们内在的精神力量转化为替身.空条徐伦,和他父亲一样,有"替身力量".她的替身被称为石之自 ...
- Grocery Problem(https://acs.jxnu.edu.cn/problem/NOIOPJENGLISH05)
题目: Grocery Problem 1000ms 65536K 描述: Find the prices of 4 items so that the sum of prices is 711 a ...
- Deli Deli(https://acs.jxnu.edu.cn/problem/HDU1804)
2022寒假翻译17 熟食店 1000 ms 32768 k 描述: Deli太太经营一家熟食店"Deli Deli".去年,德里太太决定扩大她的生意,建立一个网上商店.她聘请了一 ...
- Joker(https://acs.jxnu.edu.cn/problem/GYM103496J)
2022寒假训练11 小丑 1000 ms 262144 k 描述: 辛迪认为对她的运动能力的一个很好的补充就是学习灵巧的手,还有什么比学习一些很酷的纸牌戏法更好的方法呢?这是变戏法的艺术!骗术! 爱 ...
- https://acs.jxnu.edu.cn/problem/GYM103495E
石之海 4000ms 0k 描述: 在JoJo的世界里,有些人能够将他们内在的精神力量转化为替身.空条徐伦,和他父亲一样,有"替身力量".她的替身被称为石之自由,可以操纵弦.不幸的 ...
- https://acs.jxnu.edu.cn/problem/ICPCJX2020D
描述: Recently, God Liu has been so absorbed in the Pac-Man game that he has even neglected his young ...
- Telegraf-Influxdb-Grafana容器化部署拓展(Https、AD域、告警集成)并监控Cisco设备指标
前言: 还记得在去年的笔记中提到过使用python的pysnmp模块,配合Influxdb,Grafana收集Cisco设备指标.链接如下:https://blog.csdn.net/tushanpe ...
- 2272: 又是01串(http://acm.zzuli.edu.cn/problem.php?id=2272csrf=nr0h1HsiO5WDrN3Jk1j9aUmgYOdn7QAV)
题目描述 给定一个0-1串s,长度为n,下标从0开始,求一个位置k,满足0<=k<=n, 并且子串s0..k−1中的0的个数与子串sk..n−1中1的个数相等. 注意: (1) 如果k = ...
- Continued Fraction翻译
题目链接:https://acs.jxnu.edu.cn/problem/ICPCJX2021B 描述: 一个连续的分数是以以下的形式表示出来的: (见题图) a0,a1,-,ana0,a1,-,an ...
最新文章
- 千万不要把 bool 当成函数参数
- 技术不够时间来凑,梦圆国一永不放弃
- 云计算机教室安装学生软件,新东方云教室1.6版本
- python运维开发之第八天(socket)
- 宇宙的最原始状态是个什么样子
- [深度学习-实践]GAN基于手写体Mnist数据集生成新图片
- 【密码学基础】05 有限域
- 如何进入百度、阿里,一个6年Android老司机的面经
- 应届毕业生软件测试面试流程、面试问题总结
- 精简ttf,svg字体库文件,删除多余字体,保留用到字体
- 3.19美团实习面试一面二面(已offer)
- win10 nginx部署前端项目(静态资源服务器和HTML)
- c语言极限方法求e方法,极限值确定函数式中参数的求解方法.pdf
- HTML学习笔记及案例(第五周 第1次)
- 【龙芯1c库】封装硬件pwm接口和使用示例
- ES module和commonJS循环引用问题
- 【问题篇】免费下载使用RDM
- 氤氲夜风中,楚楚温存
- 一文带你了解 三种深度学习框架(Caffe,Tensorflow,Pytorch)的基本内容、优缺点以及三者的对比
- c语言编程题及答案汇总,C语言编程题及参考答案解析.doc