Title Link: http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1265
Description
An example of a traditional dice are a rounded cube with each of its six faces showing a different number of dots from 1 t o 6. When thrown or rolled, the dice comes to rest showing on its upper surface a random integral points from one to six, each Value being equally likely.
----Wikipedia
Now we have a dices which both with six faces. Can you tell us the probability, the sum points of the dices equals S when we thrown?
Input
There is an integer t (1 <= T <= one) in the first line, means there was T test cases in total.
For each test case, there was only a line with one integer S (2 <= s <=), which has the same meaning as above.
Output
For each test case, you should print the probability, the sum points of both dices equals S when we thrown. The answer should is in one line and rounding to 6 decimals.
Print a blank line after each test case.
Sample Input
223
Sample Output
0.0277780.055556
HINT
Source
Seventh session of university student Program design Competition-warm-up
The code is as follows:
#include <cstdio>int main () { int t; int sum; scanf ("%d", &t); while (t--) { scanf ("%d", &sum); int cont=0; for (int i = 1, i <= 6; i++) {for (int j = 1; J <= 6; j + +) { if (i+j==sum) cont++; } } printf ("%.6lf\n\n", cont/36.0); } return 0;}
CSU 1265:dice (Math AH)