Codeforces #362 div2 B. barnicle

Source: Internet
Author: User

Topic Link: B. barnicle

Test instructions: The scientific notation is converted into decimal integers or decimals and output.

Idea: Summer training game met, then thigh a dropped, and said it is a water problem.

Brush CF met again, mercilessly wa a few times. Like what:

0.E0 0

1.0E0 1

Suddenly feel that they can no longer rely on CF this look at the model of sample Dbug.

Attached code:

The scientific notation is converted into decimal integers or decimals and outputs # include <stdio.h> #include <string.h> #include <iostream>using namespace    Std;string Str;int Main () {//freopen ("In.cpp", "R", stdin);        while (CIN >> str) {string ans = "";        int len = Str.length ();        int lose;                for (int i=len-1; i>=0;-I.) {if (str[i] = = ' E ') {lose = i;            Break        }} int a = str[0]-' 0 ';            if (a = = 0) {int endd = 0; for (int i=lose-1; i>=0;-i) {if (Str[i] > ' 0 ' && str[i] <= ' 9 ') {End                    d = i;                Break            }} str.resize (endd+1);            cout << str << Endl;        Continue        } ans + = str[0];        int b = 0;        for (int i=lose+1; i<len; ++i) {b = b*10 + str[i]-' 0 ';        } int cnt1 = 0; BOOL first = FALSE; for (int i=2; i<lose;            ++i) {if (Cnt1 < b) {ans + = str[i];                    } else {if (first = = False) {first = true;                Ans + = '. ';            } ans + = str[i];        } cnt1++;            } while (Cnt1 < b) {ans + = ' 0 ';        cnt1++; } if (ans[1] = = '. ')            {int anslen = Ans.length ();            bool OK = false; for (int i=2; i<anslen; ++i) {if (Ans[i] > ' 0 ' && ans[i] <= ' 9 ') {OK                    = true;                Break        }} if (!ok) ans.resize (1);    } cout << ans << endl; } return 0;}

Codeforces #362 div2 B. Barnicle

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.