当前位置:网站首页>P2394 yyy loves Chemistry I
P2394 yyy loves Chemistry I
2022-06-28 09:12:00 【A program ape who smashes the keyboard】
P2394 yyy loves Chemistry I
# yyy loves Chemistry I
## Background
Because I will eat the car back , So I put it in the title description ~
## Title Description
[ The story background ]
Once upon a time , There's a man named yyy, He especially likes chemistry , Especially some are very dangerous (zuo) risk (si) The experiment of .
[ Background ]
This day , He began to work out a magical and interesting equation
2Na + 2H2O ==== 2NaOH + H2↑
[ Problem description ]
Now? yyy The mass of a piece is xg Put a lot of sodium into the water , Then start collecting hydrogen .
Final , We know , later , The sodium disappeared in the water . and yyy A bad , All the hydrogen has been collected .
** Every known investment 23 Gram of sodium , Will generate 1 Grams of hydrogen .**
So now yyy How many grams of hydrogen are collected ?
## Input format
a line , A real number x, representative yyy How many grams of sodium are put into the water
The end of the input file line must be ** Can't ** One of them has returned ~
## Output format
a line , A real number ( Round to the nearest 8 Decimal place ), Represents how many grams of hydrogen are produced
## Examples #1
### The sample input #1
```
0.23
```
### Sample output #1
```
0.01000000
```
## Tips
[ Data scale ]
about 100% The data of ,0<x<=1
[ Tips ]
Do you want to know x Are there any decimals ? I won't give it to you >\_<
All I know is that the space limit is 4M, The time limit is 0.1s, And if you read all the numbers down, it might MLE Slightly ~
kkksc: No data range ! Input files do not exceed 5M!
The author : How can it be like this ! Bad review ! I can't dig a hole !
【 translate 】
Enter a
Dead manVery long real numbers x, Output x/23 Retain 8 A decimal value .
【AC Code 】
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<string>
#include<vector>
using namespace std;
long double x;
signed main()
{
scanf("%15Lf",&x);
cout<<fixed<<setprecision(8)<<x/23;
return 0;
}
learn Before Lesson , Before writing the code this time, I have done a good job of adjusting the accuracy Get ready .

【 High level practices 】
#include <iostream>
#include <cstdio>
using std::scanf;
using std::printf;
int x;
char c;
int len(int a) // The length of the returned number
{
if (a==0)
return 1;
int ans=0;
while (a)
{
++ans;
a/=10;
}
return ans;
}
int main()
{
if ((c=getchar())=='1') // Special judgement
{
long double y=1;
printf("%.8Lf", y/23);
return 0;
}
getchar();
bool flg=false;
for (int i=1; i<=9; ++i)
{
if (!flg)
c=getchar();
if (c>'9'||c<'0')
x*=10, flg=true;
else
x=(x<<3)+(x<<1)+c-'0';
}
x=(x/23+5)/10; // rounding
putchar('0');
putchar('.');
int length=len(x);
for (int i=1; i<=8-len(x); ++i) // Fill in the leading zero
putchar('0');
printf("%d\n", x);
return 0;
}
selected from Yingchuyin bucket rubber
Tarragon konjakA man( Tangled to play a man )Of TJ.Yuan Longping : The biggest mistake of my life is to let
Yingchuyin bucket rubberChinese people have nothing to do when they are full of food
边栏推荐
- Applet: traverse the value of an array in the list, which is equivalent to for= "list" list An item in comment
- [.Net6] GRP server and client development cases, as well as the access efficiency duel between the minimum API service, GRP service and traditional webapi service
- Scenario method and error recommendation method for learning basic content of software testing (2)
- Rich text - Test Case
- 网上炒股开户安不安全?
- Illustration of MySQL binlog, redo log and undo log
- Redis5.0 slot migration, free play (single machine migration cluster)
- Analysis of prepaid power purchase device
- APICloud携手三六零天御,助力企业守好App安全“第一关”
- 基于宽表的数据建模
猜你喜欢

How to solve the problem of port number occupation

Import and export of a single collection in postman

Loggerfactory uses log4j Parameter introduction of properties

Data mining modeling practice

Redis5.0 slot migration, free play (single machine migration cluster)

1181:整数奇偶排序

用Pytorch搭建第一個神經網絡且進行優化

使用transform:scale之后导致页面鼠标悬浮事件消失

1182: group photo effect

SQL注入之文件读写
随机推荐
1182: group photo effect
静态代码块永远先执行? 格局小了!!!
What are the advantages of a differential probe over a conventional probe
自动转换之-面试题
It only takes two steps to find the right PMP organization, one check and two questions
Error: `brew cask` is no longer a `brew` command. Use `brew <command> --cask` instead.
Rich text - Test Case
MATLAB小技巧(20)矩阵分析--主成分回归
Quickly understand JVM structure and working principle
Implementation of single sign on
Calculation of stock purchase and sale expenses
STL - inverter
Discussion on the improvement and application of the prepayment system in the management of electricity charge and price
两道面试小Demo
Redis5.0 slot migration, free play (single machine migration cluster)
Fire fighting work and measures in Higher Vocational Colleges
Is it safe to open an account for mobile phone stock speculation?
spark的资源调度和任务调度
Installation of containerd1.5.5
How do I open an account on my mobile phone? Is it safe to open an account online now?