A1078 | [COCI-2006_2007-contest4]#3 PRSTENI
来源COCI
时间限制1s
内存限制128MB
通过 / 提交0/0
题目描述
After an exhausting morning, Mirko fell asleep. His brother Stanko, however, just awoke and, like his brother, is all about excitement. Stanko found N rings of varying radiuses in the garage. He arranged them on the floor so that each ring (except the first and last) touches the ones before and after it.
He started turning the first ring and noticed that the other rings turned as well; some faster, some slower!
Thrilled with his discovery, he decided to count how many times the other rings turn while the first ring turns once. He gave up after noticing that this number is not always an integer and not knowing what to do.
Write a program that determines how many times each ring turns while the first turns once.
He started turning the first ring and noticed that the other rings turned as well; some faster, some slower!
Thrilled with his discovery, he decided to count how many times the other rings turn while the first ring turns once. He gave up after noticing that this number is not always an integer and not knowing what to do.
Write a program that determines how many times each ring turns while the first turns once.
输入格式
The first line of input contains an integer N (3 ≤ N ≤ 100), the number of rings.
The next line contains N integers between 1 and 1000, the radiuses of Stanko's rings, in the order they are laid out on the floor.
The next line contains N integers between 1 and 1000, the radiuses of Stanko's rings, in the order they are laid out on the floor.
输出格式
The output must contain N-1 lines. For every ring other than the first, in the order they are given in the input, output a fraction A/B, meaning that the respective ring turns A/B times while the first ring turns once.
The fractions must be in reduced form (the numerator and denominator must not have a common divisor larger than 1).
The fractions must be in reduced form (the numerator and denominator must not have a common divisor larger than 1).
输入输出样例
输入 #1
3 8 4 2
输出 #1
2/1 4/1
输入 #2
4 12 3 8 4
输出 #2
4/1 3/2 3/1
输入 #3
4 300 1 1 300
输出 #3
300/1 300/1 1/1
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted