编程介的小学生 2017-01-22 05:42 采纳率: 20.5%
浏览 917
已采纳

Consecutive Digits

问题描述 :

As a recruiting ploy, Google once posted billboards in Harvard Square and in the Silicon Valley area just stating “{first 10-digit prime found in consecutive digits of e}.com”. In other words, find that 10-digit sequence and then connect to the web site — and find out that Google is trying to hire people who can solve a particular kind of problem.
Not to be outdone, Gaggle (a loosy-goosy fuzzy logic search firm), has devised its own recruiting problem. Consider the base 7 expansion of a rational number. For example, the first few digits of the base 7 expansion of 1/510 = 0.12541…7, 33/410 = 11.15151…7, and 6/4910 = 0.06000…7, From this expansion, find the digits in a particular range of positions to the right of the “decimal” point.

输入:

The input file begins with a line containing a single integer specifying the number of problem sets in the file. Each problem set is specified by four base 10 numbers on a single line, n d b e, where n and d are the numerator and denominator of the rational number and 0 <= n <= 5,000 and 1 <= d <= 5,000. b and e are the beginning and ending positions for the desired range of digits, with 0 <= b,e <= 250 and 0 <= (e-b) <= 20. Note that 0 is the position immediately to the right of the decimal point.
输出:

Each problem set will be numbered (beginning at one) and will generate a single line:Problem set k: n / d, base 7 digits b through e: result
where k is replaced by the problem set number, result is your computed result, and the other values are the corresponding input values.

样例输入:

41 5 0 06 49 1 333 4 2 7511 977 122 126
样例输出:

Problem set 1: 1 / 5, base 7 digits 0 through 0: 1Problem set 2: 6 / 49, base 7 digits 1 through 3: 600Problem set 3: 33 / 4, base 7 digits 2 through 7: 151515Problem set 4: 511 / 977, base 7 digits 122 through 126: 12425

  • 写回答

1条回答 默认 最新

  • devmiao 2017-01-29 17:33
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 delta降尺度方法,未来数据怎么降尺度
  • ¥15 c# 使用NPOI快速将datatable数据导入excel中指定sheet,要求快速高效
  • ¥15 再不同版本的系统上,TCP传输速度不一致
  • ¥15 高德地图点聚合中Marker的位置无法实时更新
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程