HDU 4530 (mathematics)

Source: Internet
Author: User

Small Q Series Story--Big Ben

Time limit:600/200 MS (java/others) Memory limit:65535/32768 K (java/others)
Total submission (s): 1458 Accepted Submission (s): 734


Problem Description suffered emotional distress of small Q this plan to seclusion for some time, but only on March 25 day did not appear, there are many friends miss him, so, he decided to come out again today, formally and everyone to do a farewell.
  
Small Q recently sleep condition is very poor--night can't sleep, in the morning again not to come! He was even a few times late this month, though the director didn't say anything, but he knew the seriousness of it.
Love has not, small q don't want to lose bread, so he decided to buy an alarm clock, for the quality of reliable, deliberately picked a most expensive original import! However, is the so-called house leakage of the night rain, people unlucky when drinking cold water are stuffed teeth, small q new bought this import alarm clock is always more than the correct time to slow so a few seconds!
Poor little Q angrily said: "What a Big Ben!" ”
But in order to make full use of Big Ben, little Q still tries to figure out its performance, hoping to use it as a normal clock.
Small Q from the following three aspects to study Big Ben:
1, assuming the normal time to walk the T-minute, calculate the time of Big Ben Walk;
2, suppose Big Ben walked the T minute, calculates the time which the normal time walks;
3, Small q will Big Ben and the current time to adjust to the correct time, at this time as the No. 0 time, the calculation of the second Big Ben Big Show the time and the correct time of the same time (the structure of large Ben and the common clock is the same, that is divided into 12 grid, 60 small lattice).

Input data The first line is a positive integer t, indicating that there is a total of T-group test data;
The next group of data first enters positive integer x, which indicates that Big Ben is slower than the normal clock for x seconds per minute;
The next line is a positive integer q, which indicates a total of q queries;
Next Q line, each line first input inquiry method (1, 2 or 3, corresponding to small Q study Big Ben's three aspects), if input 1 or 2, then enter the positive integer t, if input 3, then enter the positive integer K (t and k meaning see topic).

[Technical specification]
T <= 100
X < 60
Q <= 100
T <= 10000
K <= 10

Output outputs the answer to be computed, in seconds, with two decimal places, one row per query output (see sample).

Sample Input1131 22 23 1

Sample Output118.00122.032592000.00 1. Normal clock every walk 1s, Big ben walk 60-t/60 s, so the normal clock per walk xs, Big Ben Walk (1-T/60) *x s.2. Big Ben 1s per walk, normal clock walk 60/60-t s, the With the Big Ben clock each walk xs, normal clock walk 60*x/(60-t) s.3. To 00:00:00 as a reference system, Big Ben every walk to a circle than the normal clock less 60*12*x s, so the normal clock chase 12*3600/12*60*x = 60/x ring can meet with the great Ben Clock once, The time required to meet K Times is k*12*3600* (60/x)
#include <stdio.h>#include<string.h>#include<iostream>#include<algorithm>using namespacestd;intMain () {inttcase; scanf ("%d",&tcase);  while(tcase--){        intt,m,a,b; Doubleans; scanf ("%d%d",&t,&m);  while(m--) {scanf ("%d%d",&a,&b); if(a==1) {ans= b* ( --T) *1.0; }            if(a==2) {ans=60.0*b* -/( --t); }            if(a==3) {ans= b*3600* A*60.0/T; } printf ("%.2lf\n", ans); }    }    return 0;}

HDU 4530 (mathematics)

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.