Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- #include <cstdlib>
- #include <iostream>
- #include <algorithm>
- #include <vector>
- #include <string>
- #include <string.h>
- #include <queue>
- #include <stack>
- #include <deque>
- #include <map>
- #include <set>
- #include <cmath>
- #include <sstream>
- #include <ctime>
- #define pb push_back
- #define mp make_pair
- #define PI 3.1415926535897932384626433832795
- #define ALL(x) x.begin(), x.end()
- #define F first
- #define S second
- #define m0(x) memset(x,0,sizeof(x))
- #define m1(x) memset(x,-1,sizeof(x))
- #define pw(x) (1ull<<(x))
- using namespace std;
- typedef long long ll;
- typedef unsigned long long ull;
- typedef long double ld;
- typedef pair<int,int> pii;
- const int INF = 2147483647;
- const ll LLINF = 9223372036854775807LL;
- //фу, плохой код, ужасный
- double perevod(char *str) {
- double ans = 0;
- while (*str>='0' && *str<='9') {
- ans=ans*10+*str-'0';
- str++;
- }
- if (*str=='.') {
- double del = 1;
- str++;
- while (*str>='0' && *str<='9') {
- del*=0.1;
- ans+=(*str-'0')*del;
- str++;
- }
- }
- return ans;
- }
- int main() {
- //freopen("input.txt", "r", stdin);
- //freopen("output.txt", "w", stdout);
- char str[100];
- gets(str);
- printf("%.10lf\n", perevod(str));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment