[hackerrank]Manasa and Stones
2014-08-15 20:22
169 查看
https://www.hackerrank.com/contests/w2/challenges/manasa-and-stones
简单题。
简单题。
#include<iostream> using namespace std; int main() { int T; cin >> T; while (T--) { int n, a, b; cin >> n >> a >> b; // a < b if ( a > b) { int tmp = a; a = b; b = tmp; } int last = 0; for (int i = 0; i < n; i++) { int x = i * b + (n - i - 1) * a; if (x != last) { last = x; cout << x << " "; } } cout << endl; } return 0; }
相关文章推荐
- 【HackerRank】Manasa and Stones
- HackerRank "Manasa and Prime game"
- HackerRank# Wet Shark and Two Subsequences
- Manasa and Stones
- [HackerRank University CodeSprint]Unique Divide And Conquer
- HackerRank "Kitty and Katty"
- HackerRank: Sam and sub-strings
- Hackerrank manasa-and-combinatorics(数学推导)
- 文章标题 HackerRank - mehta-and-the-typical-supermarket (容斥原理)
- 【HackerRank】 Sherlock and The Beast
- HackerRank "Array and simple queries" !
- [hackerrank]John and GCD list
- [hackerrank]Bob and Ben
- HackerRank Medium(30) Maximal AND Subsequences 贪心+计数
- *[hackerrank]Kundu and Tree
- [Hackerrank题目选做] Jim And Challenges
- HackerRank "Sherlock and Cost"
- HackerRank "Shashank and List"
- HackerRank - "Snakes and Ladders: The Quickest Way Up"
- 【HackerRank】【HourRank 20】Birjik and Nicole's Tree Game