当前位置:网站首页>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
边栏推荐
- Copy & Deepcopy
- Privacy computing fat----- offline prediction
- It only takes two steps to find the right PMP organization, one check and two questions
- Deployment of MySQL database in Linux Environment
- Analysis of prepaid power purchase device
- Construire le premier réseau neuronal avec pytorch et optimiser
- Protection range and optimization of motor protector for hoist equipment
- Music website design based on harmonyos (portal page)
- 1182: effets de la photo de groupe
- break database---mysql
猜你喜欢

数据挖掘建模实战

Rman Backup Report Ora - 19809 Ora - 19804

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

Error: `brew cask` is no longer a `brew` command. Use `brew <command> --cask` instead.

Which is a better ERP management system for electronic component sales?

rman備份報ORA-19809 ORA-19804

Assertions used in the interface automation platform

Postman interface test

Fire fighting work and measures in Higher Vocational Colleges

图解MySQL的binlog、redo log和undo log
随机推荐
How to implement two factor authentication MFA based on RADIUS protocol?
学习阿里如何进行数据指标体系的治理
1182: effets de la photo de groupe
电子元器件销售ERP管理系统哪个比较好?
Discussion on the practice of fire emergency lighting system in the field of building electrical design
Error: `brew cask` is no longer a `brew` command. Use `brew <command> --cask` instead.
Boundary value analysis method for learning basic content of software testing (2)
Data mining modeling practice
Power data
Scenario method and error recommendation method for learning basic content of software testing (2)
Matlab tips (20) matrix analysis -- principal component regression
Is it safe to open an account for mobile phone stock speculation?
状态机程序框架
Copy & Deepcopy
A - Bi-shoe and Phi-shoe
SQL 優化經曆:從 30248秒到 0.001秒的經曆
Goldbach`s Conjecture
SQL 优化经历:从 30248秒到 0.001秒的经历
Power data
Prototype chain JS