编程介的小学生 2017-02-15 13:26 采纳率: 20.3%
浏览 853
已采纳

Arcane Numbers 2

Problem Description
Vance and Shackler like playing games. After playing "arcane numbers", they find a new game “arcane numbers 2”. The game is also pretty simple. Vance first chooses 3 non-negative integers A, B and N, then he writes down B+A, B+A*2…B+A*N under base 2 and sends it to Shackler, after that Vance will ask him how many 1s are there in the sequence. However, the sequence is too long for Shackler and he turns to you for help. Given you A, B and N, please help Shackler to solve the problem.

Input
The first line contains a single integer T (T <= 20), the number of test cases. Then there are T lines with each case in a line. For each case, there are three integers A, B, N. 1<=A<=10000, 1<=B<=10^16, 1<=N<=10^12.

Output
For each case, you should print one line begin with “Case #”(quotations for explanation only) followed by the case number and a colon. After a single space, you should output the answer. (See the sample output for more details)

Sample Input
2
4 7 1
5 8 2

Sample Output
Case #1: 3
Case #2: 5

  • 写回答

2条回答 默认 最新

  • devmiao 2017-02-17 20:32
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 使用ESP8266连接阿里云出现问题
  • ¥15 BP神经网络控制倒立摆
  • ¥20 要这个数学建模编程的代码 并且能完整允许出来结果 完整的过程和数据的结果
  • ¥15 html5+css和javascript有人可以帮吗?图片要怎么插入代码里面啊
  • ¥30 Unity接入微信SDK 无法开启摄像头
  • ¥20 有偿 写代码 要用特定的软件anaconda 里的jvpyter 用python3写
  • ¥20 cad图纸,chx-3六轴码垛机器人
  • ¥15 移动摄像头专网需要解vlan
  • ¥20 access多表提取相同字段数据并合并
  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角