from __future__ import print_function

 def main():
t = int(raw_input())
for _ in range(t):
n = int(raw_input())
a = int(raw_input())
b = int(raw_input())
possible_value = []
for _ in range(n):
temp_value = (_ * a + (n - 1 - _) * b) # 抽象化理解题目的意思
if temp_value not in possible_value:
possible_value.append(temp_value)
possible_value.sort() # 使用list结构的方便性
for _ in possible_value:
print(_, end = ' ') # 使用Dash帮助自己理解这个函数
print()
main()

Link:

  https://www.hackerrank.com/challenges/manasa-and-stones

学习:

  Dash的辅助使用

    怎样修改相应的参数

    调用合适的函数

  合理数据结构的选用

    做题时候选用合适的数据结构

Manasa and Stones的更多相关文章

  1. 【HackerRank】Manasa and Stones

    Change language : Manasa 和 她的朋友出去徒步旅行.她发现一条小河里边顺序排列着带有数值的石头.她开始沿河而走,发现相邻两个石头上的数值增加 a 或者 b. 这条小河的尽头有一 ...

  2. [hackerrank]Manasa and Stones

    https://www.hackerrank.com/contests/w2/challenges/manasa-and-stones 简单题. #include<iostream> us ...

  3. HDU 5973 Game of Taking Stones 威佐夫博弈+大数

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5973 Game of Taking Stones Time Limit: 2000/1000 MS ...

  4. HDU 4573 Throw the Stones(动态三维凸包)(2013 ACM-ICPC长沙赛区全国邀请赛)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4573 Problem Description Remember our childhood? A fe ...

  5. HackerRank "Manasa and Prime game"

    Intuitive one to learn about Grundy basic :) Now every pile becomes a game, so we need to use Spragu ...

  6. codechef Jewels and Stones 题解

    Soma is a fashionable girl. She absolutely loves shiny stones that she can put on as jewellery acces ...

  7. HDU-1896 Stones

    http://acm.hdu.edu.cn/showproblem.php?pid=1896 题意:一个人从0开始走起,遇到偶数个石头就踢.要是同一位置有多个石头,则先扔最重的石头(也就是扔的最近的那 ...

  8. hdoj 1896 Stones【优先队列】

    Stones Time Limit: 5000/3000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Subm ...

  9. Stones(优先队列)

    Stones Time Limit: 5000/3000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Subm ...

随机推荐

  1. Net线程池设计

    Net线程池设计 功能描述: 支持创建多个线程池,并统一管理 支持不同线程池的容量控制,以及最少活动线程的设置 支持不同线程池中活动线程的闲时设置,即线程空闲时间到期后即自动被回收 结构设计: Thr ...

  2. loadView/viewDidLoad/initWithNibName/awakeFromNib/initWithCoder的用法总结

    loadView/viewDidLoad/initWithNibName/awakeFromNib/initWithCoder的用法总结   首先,区别程序化初始viewcontroller,半程序化 ...

  3. C语言中如何获得文件大小

    方法一: 获得文件大小需要用到2个函数:fseek() , ftell() fseek()函数: 原型:intfseek(FILE *stream, long offset, int fromwher ...

  4. Java基础语法学习(1)switch...case

    switch...case的标准语法 switch(待选择的变量) { case 值1:语句1; break; case 值2:语句2: break; ....... case 值n:语句n; bre ...

  5. Android Studio builde.gradle 配置说明

    //声明是Android应用程序 apply plugin: 'com.android.application' android { //编译SDK版本 compileSdkVersion 21 bu ...

  6. #if defined 的意思?

    在读s3c2440a的test程序,其中option.h文件中有段语句为: #define LCD_N35 //#define LCD_L80 //#define LCD_T35 //#define ...

  7. list append 总是复制前面的参数,而不复制最后一个参数

    append 总是复制前面的参数,而不复制最后一个参数 (define a1 '(1 2 3)) (define a2 '(a b c)) (define x (append a1 a2)) x ; ...

  8. Splay入门题目 [HNOI2002]营业额统计

    题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=1588 这道题貌似很多中做法,我先是用multiset交了一发,然后又写了一发splay. ...

  9. [Cycle.js] Introducing run() and driver functions

    Currently the code looks like : // Logic (functional) function main() { return { DOM: Rx.Observable. ...

  10. ssh命令

    使用ssh命令登陆远程系统 ssh [ip/address] -l [登陆用户名] 如: ssh www.xyz.cn -l root