zoukankan      html  css  js  c++  java
  • NEFU 1146 又见A+B

    又见a+b

    Problem:1146

    Time Limit:1000ms

    Memory Limit:65535K

    Description

    给定两个非负整数A,B,求他们的和。

    Input

    多组输入,每组输入两个非负整数A和B(0<=A,B<10^3000),可能会有前缀0,但保证总长度不超过3000。

    Output

    输出A+B的和,结果对10000007取余。

    Sample Input

    100
    200
    31415926535897932384626
    2718281828
    

    Sample Output

    300
    9329232
    

    Hint

     

    Source

    第一次自己出的题 纪念一下

    #include <iostream>
    #include <string.h>
    using namespace std;
    #define mod 10000007
    typedef long long ll;
    int main()
    {
        int i;
        ll a,b;
        char c[3005],d[3005];
        while(cin>>c>>d)
        {
            int len1=strlen(c);
            int len2=strlen(d);
            a=c[0]-'0';
            b=d[0]-'0';
            for(i=1;i<len1;i++)
            a=(a*10+c[i]-'0')%mod;
            for(i=1;i<len2;i++)
            b=(b*10+d[i]-'0')%mod;
            cout<<(a+b)%mod<<endl;
        }
        return 0;
    }
  • 相关阅读:
    sklearn
    Scrapy
    正则表达式re
    BeautifulSoup
    requests
    Python网络爬虫与信息提取
    Matplotlib
    Pandas
    NumPy
    制约大数据处理能力的几个问题
  • 原文地址:https://www.cnblogs.com/Ritchie/p/5416097.html
Copyright © 2011-2022 走看看