答案 :
# include <iostream>
using namespace std ;
int main() {
int input ;
bool first = true ;
while ( cin >> input ) {
if ( first == false ) cout << "\n" ;
first = false ;
cout << input * 19600 + 1275 ;
} // while
} // main()
理論 :
a1 = 1, n = 50, d = input
a1 = 1
a2 = a1 + 1 + d * 0
a3 = a2 + 1 + d * 1
...
+) a50 = a49 + 1 + d * 48
-----------------------------
a1 + a2 + ... + a50 = a1 + a2 + ... + a49 + ( 1 * 50 ) + d * ( 0 + 1 + 2 + ... + 48 )
= a1 + a2 + ... + a49 + 50 + d * ( 0 + 48 )( 49 ) / 2
a1 + a2 + ... + a49 = a1 + a2 + ... + a48 + ( 1 * 49 ) + d * ( 0 + 1 + 2 + ... + 47 )
= a1 + a2 + ... + a48 + 49 + d * ( 0 + 47 )( 48 ) / 2
...
a1 + a2 + a3 = a1 + a2 + 3 + d * ( 0 + 1 )( 2 ) / 2
a1 + a2 = a1 + 2 + d * ( 0 + 0 )( 1 ) / 2
+ )a1 = 1
-----------------------------
( 1 + 2 + ... + 50 ) + sum [ d * ( 0 + i )( i + 1 ) / 2 ]
i = 0 ~ 48
-----------------------------
1275 + sum [ d * ( i^2 + i ) / 2 ]
i = 0 ~ 48
-----------------------------
1275 + d * ( 1 / 2 ) * [ sum ( i^2 ) + sum ( i ) ]
i = 0 ~ 48
-----------------------------
1275 + d * ( 1 / 2 ) * [ ( 1 / 6 )( 48 )( 48 + 1 )( 48 * 2 + 1 ) + ( 1 / 2 )( 48 )( 48 + 1 ) ]
= 1275 + d * ( 1 / 2 ) * ( 38024 + 1176 )
= 1275 + d * 39200 / 2
= 1275 + d * 19600