[Water] addition difficulties of codecomb small x

Source: Internet
Author: User
Background of small x addition difficulties

In the first programming class, the teacher asked everyone to write a program to calculate the sum of two positive integers.
After seeing small X's disdainful eyes, the teacher decided to make small x more difficult. Take the sum of 12 and 3 as an example.
Add unnecessary spaces to the original formula and then give it to small X.
This is silly. I hope you can help him.

Description

Calculates the sum of the two given numbers.

Input Format

The first line contains a string, indicating the expression given by the instructor to Xiao X.

Output Format

8
If the result of a sub-statement cannot exceed 10, the first row contains an integer representing the result of the sub-statement; otherwise, the first row contains a string.
"Large ".

Sample Data 1

Input

12345 + 54321

Output

66666
Sample Data 2

Input

8 0 00 0 0 00 + 2 0 00 0 01

Output

Large
Remarks

8
For 30% of the data, the formula sub-contains no useless spaces, and the formula sub-results cannot exceed 10.
For 100% of data, the string length cannot exceed 100.

Ideas

High precision is not required for questions or brute force attacks.

Code
#include<iostream>#include<cstdlib>#include<cstdio>using namespace std;long long a,b;string s;int ak,bk,sk;int main(){    getline(cin,s);    ak=0;bk=0;    sk=0;    while (s[sk]!=‘+‘)    {        if (s[sk]!=‘ ‘) {ak++;;a=a*10+int(s[sk])-int(‘0‘);}        sk++;        if (ak>12) { cout<<"Large"<<endl; return 0; }    }    sk++;    while (sk<=s.length()-1)    {        if (s[sk]!=‘ ‘) {bk++;b=b*10+int(s[sk])-int(‘0‘);}        sk++;        if (bk>12) { cout<<"Large"<<endl; return 0; }    }    a+=b;    if ((a-100000000)>0) cout<<"Large"<<endl; else cout<<a<<endl;    return 0;    }
Result

[Water] addition difficulties of codecomb small x

Related Article

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.