PKU 3086 Triangular Sums
http://poj.org/problem?id=3086
計算式を適用して結果を出力する問題。
易。
解答数稼ぎ用。
多倍長も必要ないようで、簡単です。
main(){ int dat; cin>>dat; rep(tt,dat){ cout<<tt+1<<' '; int n; cin>>n; cout<<n<<' '; int ans=0; for(int k=1;k<=n;k++)ans+=k*(k+1)*(k+2)/2; cout<<ans<<endl; } }