{"id":134,"date":"2024-04-26T13:57:38","date_gmt":"2024-04-26T05:57:38","guid":{"rendered":"https:\/\/seanxd.com\/?p=134"},"modified":"2024-04-26T13:57:40","modified_gmt":"2024-04-26T05:57:40","slug":"zerojudge-d051","status":"publish","type":"post","link":"https:\/\/seanxd.com\/en\/zerojudge-d051\/","title":{"rendered":"ZeroJudge D051: Oops, I have a fever!"},"content":{"rendered":"<p class=\"translation-block\">Sansan is studying in the United States. One day, she felt uncomfortable and drowsy all over her body, wondering if she had a fever. She went to the pharmacy and bought a thermometer to measure her temperature. She found that her temperature was 104 degrees Fahrenheit. Accustomed to Celsius in Taiwan, she didn't know how high her temperature was in Celsius. Could you help her write a program to convert the temperature from Fahrenheit to Celsius?<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Sample Inputs\/Outputs<\/h2>\n\n\n\n<figure class=\"wp-block-table nfd-wb-animate nfd-wb-fade-in-bottom-short\"><table class=\"has-fixed-layout\"><thead><tr><th>Sample Input(s)<\/th><th>Sample Output(s)<\/th><\/tr><\/thead><tbody><tr><td class=\"translation-block\">The input consists of a single line containing an integer F (-460 \u2264 F \u2264 2147483647), representing the temperature in Fahrenheit.<\/td><td class=\"translation-block\">Output the calculated temperature in Celsius, rounded to three decimal places.<\/td><\/tr><tr><td>104<\/td><td>40.000<\/td><\/tr><tr><td>98<\/td><td>36.667<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Thought Process<\/h2>\n\n\n\n<p class=\"translation-block\">When receiving the input, you can use float or double to avoid any potential issues with negative type conversion during calculations. To convert Fahrenheit temperature to Celsius, you can use the following formula: (F - 32) * 5 \/ 9. For output, you can use printf(\"%.3f\\n\", ans) to ensure the temperature is rounded to three decimal places.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Sample Code\uff0d<a href=\"https:\/\/zerojudge.tw\/ShowProblem?problemid=d051\" target=\"_blank\" rel=\"noreferrer noopener\">ZeroJudge D051: Oops, I have a fever!<\/a><\/h3>\n\n\n\n<div class=\"hcb_wrap nfd-wb-animate nfd-wb-reveal-right nfd-delay-150\"><pre class=\"prism line-numbers lang-plain\"><code>#include &lt;iostream&gt;\n#include &lt;stdio.h&gt;\nusing namespace std;\n\nint main() {\n  double N;\n  cin &gt;&gt; N;\n  double ans = (N-32) * 5 \/ 9;\n  printf(&quot;%.3f\\n&quot;, ans);\n}\n\n\/\/Z.O.J D051\n\/\/Dr. SeanXD<\/code><\/pre><\/div>","protected":false},"excerpt":{"rendered":"<p>\u73ca\u73ca\u5728\u7f8e\u570b\u8b80\u66f8\uff0c\u6709\u4e00\u5929\u89ba\u5f97\u660f\u6c89\u6c89\u7684\u5168\u8eab\u4e0d\u8212\u670d\uff0c\u5fc3\u60f3\u81ea\u5df1\u662f\u4e0d\u662f\u767c\u71d2\u4e86\u3002\u5230\u85e5\u5c40\u8cb7\u4e86\u4e00\u652f\u9ad4\u6eab\u8a08\u91cf\u4e86\u4e00\u4e0b\u9ad4\u6eab\uff0c\u767c\u73fe\u5979\u7684 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","footnotes":""},"categories":[6],"tags":[7],"class_list":["post-134","post","type-post","status-publish","format-standard","hentry","category-6","tag-7"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/134","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/comments?post=134"}],"version-history":[{"count":2,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/134\/revisions"}],"predecessor-version":[{"id":136,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/posts\/134\/revisions\/136"}],"wp:attachment":[{"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/media?parent=134"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/categories?post=134"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/seanxd.com\/en\/wp-json\/wp\/v2\/tags?post=134"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}