Triangular Sums http://acm.nyist.net/JudgeOnline/problem.php?pid=122
生活随笔
收集整理的這篇文章主要介紹了
Triangular Sums http://acm.nyist.net/JudgeOnline/problem.php?pid=122
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
?
Triangular Sums
時間限制:3000 ms ?|? 內存限制:65535 KB 難度:2 描述The?nth?Triangular?number,?T(n) = 1 + … +?n, is the sum of the first?n?integers. It is the number of points in a triangular array with?n?points on side. For example?T(4):
XX X
X X X
X X X X
Write a program to compute the weighted sum of triangular numbers:
W(n) =?SUM[k?= 1…n;?k?*?T(k?+ 1)]
Each dataset consists of a single line of input containing a single integer n, (1 ≤ n ≤300), which is the number of points on a side of the triangle.
一看題估計你會蒙了,但是一看代碼估計你會笑,其實此題不難,難的是理解不了題意。題意是給你一個數n,然后求出前n+1項和T(n+1),然后計算n*T(n+1);輸出時注意格式就行了。
轉載于:https://www.cnblogs.com/wangyouxuan/p/3248825.html
總結
以上是生活随笔為你收集整理的Triangular Sums http://acm.nyist.net/JudgeOnline/problem.php?pid=122的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: VC中CCheckListBox使用注意
- 下一篇: iOS SEL类型和创建