Bnuoj34976 count Bacteria

Source: Internet
Author: User
Count Bacteria Time limit:1000 ms Memory limit:65536 kbspecial Judge64-bit integer Io format: % LLD Java class name: mainprev submit status Statistics discuss nextfont size: +  -

James discovered a bacteria that will be re-split into three bacteria on the first day after the split, that is, if one newly split bacteria exists on the first day, there is still one bacteria in the first day, 3 new bacteria split out in the second day, 3 bacteria in the second day, 9 bacteria in the second day... It is known that there are several of these bacteria in a petri dish, 1st days there are a bacterial, 2nd days there are B bacteria. Tom wants to know how many bacteria are in the petri dish on the nth day. The result (ANS) may be very large and only logs are output.10 (ANS.

Input

The first input behavior is an integer T (T ≤ 1000) indicating the number of data groups.

The three numbers of data in each group are a, B, n (1 ≤ A, B, n ≤ 10 in sequence.18 ).

Output

For each group of data, a floating point number is output to indicate the result. The error is within 1-6.

Sample Input
11 3 3
Sample output
0.4771212547
Source 12th Beijing Normal University Program Design Competition finals authortemperlsyer
# Include <stdio. h> # include <math. h> int main () {int t; long K1, K2, n, a, B; scanf ("% d", & T); While (t --) {scanf ("% LLD", & A, & B, & N); long TA = A, TB = B, mm; A = (Tb-Ta)/2; // number of cells in the first day after split. B = Ta-; // Number of new cells in the first day k1 = n/2; k2 = (n-1)/2; If (k1 = k2) Mm = 1; else Mm = 3; if (n> = 3) printf ("%. 10lf \ n ", K2 * log10 (3.0) + log10 (double) (A * mm + B ))); // The multiplication in the log equals to the addition of else if (n = 1) printf ("%. 10lf \ n ", log10 (double) (TA * 1.0); else if (n = 2) printf (" %. 10lf \ n ", log10 (double) (Tb * 1.0 )));}}


Bnuoj34976 count Bacteria

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.