我是個對電腦科學有興趣的學生,我會貼上我的學習歷程及生活心情,也請大大們多多指教。 :)

2015年6月11日 星期四

[UVa] 10302 - Summation of Polynomials

題目網址: https://goo.gl/GxsoXV

題意:
(from luckycat)


解法:
帶和公式,
證明於此 http://www.funlearn.tw/viewthread.php?tid=1956

TAG: Math

注意:

程式碼:
/**
* Tittle: 10302 - Summation of Polynomials
* Author: Cheng-Shih, Wong
* Date: 2015/06/11
*/
// include files
#include <bits/stdc++.h>
using namespace std;
// definitions
#define FOR(i,a,b) for( int i=(a),_n=(b); i<=_n; ++i )
#define clr(x,v) memset( x, v, sizeof(x) )
typedef long long ll;
// declarations
ll n;
// functions
// main function
int main( void )
{
// input
while( scanf( "%lld", &n )==1 ) {
printf( "%lld\n", (n*n*(n+1)*(n+1))/4 );
}
return 0;
}

沒有留言:

張貼留言

任何意見都樂意傾聽