Traditional Culture Encyclopedia - Traditional virtues - Popular explanation of the traditional problem of noi
Popular explanation of the traditional problem of noi
Mother-in-law said: Is there any sample input and output? NOI usually has it. One more question, check the input and output files again and again to see if there are any regulations. Usually, you should specify a file name. If I hadn't said it, times might have been different. )
The problem is a bit tricky, because floating-point numbers are binary expressions in computers, and some information in decimal cannot be accurately expressed (which varies from device to device)
Suggested solution:
Wrong judgment (simple)
//Add a variable:
doubke dt
//Add a constant:
# Define jd (double)0.000 1
//One ten thousandth of a second depends on the specific accuracy requirements, just stick to the requirements, but not if the time scale is too small.
//calculation
dt = t 1-T2;
//The judgment statement is changed to
if(dt & gt; -JD & amp; & ampdt & ltJD)printf(" ALL ");
else if(dt & gt; = JD)printf(" WALK ");
else if(dt & lt; = JD)printf(" BIKE ");
Method 2
- Previous article:What are the funeral methods in China?
- Next article:What is the contact information of Shandong mask factory?
- Related articles
- Good-looking poster images - creative poster design
- What are the customs of Korean Spring Festival?
- What is the significance of flying kites at the vernal equinox?
- What was the education of children of feudal royal families in western Europe in the Middle Ages?
The education of the feudal royal family in western Europe in the Middle Ages was ().
A. E
- How to cook a dish with chicken during the Spring Festival?
- Recommended by Jiujiang Time-honored Food Store
- Cabin group word Chinese character cabin group word
- Shaolin Temple seventy-two stunts is real?
- When does Jiangsu Sports Lottery draw seven figures?
- Introduction of tourist attractions in Shilong Ancient Town, Dongying Pictures of tourist attractions in Shilong Ancient Town, Dongying