Sine Partition Function
All submissions for this problem are available.
Chef Ciel is participating an arithmetic contest now.
Because of the top prize for the contest, a limited edition toaster oven.
She must calculate the values f(M, N, X) of function named sine partition function to be the first place.
The sine partition function f(M, N, X) is defined by
Examples are following:
f(1, 3, X) = sin(3X)
f(2, 3, X) = sin(0) sin(3X) + sin(X) sin(2X) + sin(2X) sin(X) + sin(3X) sin(0) = 2 sin(X) sin(2X)
f(3, 1, X) = sin(0) sin(0) sin(X) + sin(0) sin(X) sin(0) + sin(X) sin(0) sin(0) = 0
Ciel is a great chef, however she is not good at arithmetic.
For given M, N and X, your work is calculating the value of f(M, N, X).
The first line contains an integer T, the number of test cases.
Then T test cases follow.
Each test case has 2 integers M, N and a real number X.
X has at most two digits after the decimal point.
For each test case, print the value of f(M, N, X).
This value must have an absolute or relative error no more than 10^-1.
You can safely assume the magnitude of the answer is at most 10^300.
1 <= T <= 10
1 <= M <= 30
1 <= N <= 1000000000 (10^9)
0 <= X <= 6.28 < 2*PI
5 1 3 1.57 2 3 0 3 1 2.12 1 1 5 1 30 0.3
-0.99999714638 0 0 -0.959 0.412
|Tags||hard, laycurse, oct11|
|Time Limit:||0.205966 sec|
|Source Limit:||50000 Bytes|
|Languages:||ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.3.2, CPP 6.3, CPP14, CS2, D, ERL, FORT, FS, GO, HASK, ICK, ICON, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, NODEJS, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.5, RUBY, SCALA, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC|
Fetching successful submissions
If you are still having problems, see a sample solution here.