题解

1309 条题解

  • -1
    @ 2016-10-30 13:51:57

    此题的标准解法叫做"可持久化动态仙人掌剖分"。

  • -1
    @ 2016-10-17 21:20:42

    这题约0.0000000005分

  • -1
    @ 2016-10-17 21:20:25

    9分······定难度的人调皮了

  • -1
    @ 2016-10-17 17:35:41

    怎么这么难!!!!!!!!!!
    打了一天,md,难度9就是不一样
    ```c++
    #define NAME ""
    #include <cstdio>
    #include <iostream>
    #include <iomanip>
    #include <cstring>

    using namespace std;

    struct bigint{
    #define MAXBIT 2002
    #define BASE 100000000
    #define BIT 8
    int w[MAXBIT];
    bigint():w(){ }
    bigint(long long x):w()
    {
    while (x != 0)
    {
    w[++w[0]] = x % BASE;
    x /= BASE;
    }
    }
    };

    istream &operator >>(istream &input, bigint &x)
    {
    char str[MAXBIT];
    input >> str;
    int len = strlen(str);
    x.w[0] = ((len % BIT == 0) ? 0 : 1) + len / BIT;
    for (int i = 1; i <= x.w[0]; ++i)
    {
    int t = len - i * BIT;
    int base = BASE / 10;
    for (int j = 0; j < BIT; ++j)
    {
    if (str[t + j] == 0)
    str[t + j] = '0';
    x.w[i] += (str[t + j] - '0') * base;
    base /= 10;
    }
    }
    return input;
    }

    ostream &operator <<(ostream &output, const bigint &x)
    {
    output << x.w[x.w[0]];
    for(int i = x.w[0] - 1; i >= 1; --i)
    output << setfill('0') << setw(BIT) << x.w[i];
    return output;
    }

    bigint operator + (const bigint &a, const bigint &b)
    {
    bigint c;
    c.w[0] = max (a.w[0], b.w[0]) + 1;
    for (int i = 1; i < c.w[0]; ++i)
    {
    c.w[i] += a.w[i] + b.w[i];
    c.w[i + 1] += c.w[i]/BASE;
    c.w[i] %= BASE;
    }
    if (c.w[c.w[0]] == 0)
    --c.w[0];
    return c;
    }

    bigint operator * (const bigint &a, const bigint &b)
    {
    bigint c;
    c.w[0] = a.w[0] + b.w[0];
    for (int i = 1; i <= a.w[0]; ++i)
    {
    for (int j = 1; j <= b.w[0]; ++j)
    {
    unsigned long long t = c.w[i + j - 1] + (unsigned long long) a.w[i] * (unsigned long long) b.w[j];
    c.w[i + j] += t/BASE;
    c.w[i + j - 1] = t%BASE;
    }
    }
    if (c.w[c.w[0]] == 0)
    --c.w[0];
    return c;
    }

    bigint operator - (const bigint &a, const bigint &b)
    {
    bigint c;
    c.w[0]= a.w[0]+1;
    for(int i =1; i< c.w[0]; ++i)
    {
    int o=0;
    if(a.w[i]<b.w[i]){
    c.w[i+1]--;
    o=1;
    }
    c.w[i]+=a.w[i]-b.w[i]+o*BASE;
    }
    if (c.w[c.w[0]] == 0)
    --c.w[0];
    return c;
    }

    int convert(const bigint &a)
    {
    int ret = 0, power = 1;
    for (int i = 1; i <= a.w[0]; ++i, power *= BASE)
    ret += a.w[i] * power;
    return ret;
    }

    bool operator < (const bigint &a, const bigint &b)
    {
    if (a.w[0] != b.w[0])
    return a.w[0] < b.w[0];
    else
    for(int i = a.w[0]; i >= 1; --i)
    if (a.w[i] != b.w[i])
    return a.w[i] < b.w[i];
    return false;
    }

    bool operator > (const bigint &a, const bigint &b)
    {
    return b < a;
    }

    bool operator == (const bigint &a, const bigint &b)
    {
    return (!(a < b)) && (!(b < a));
    }

    bool operator <= (const bigint &a, const bigint &b)
    {
    return !(b < a);
    }

    bool operator >= (const bigint &a, const bigint &b)
    {
    return !(a < b);
    }

    int main()
    {
    bigint a, b;
    char c;
    cin>>a>>b;
    //while(cin >> a >> b ){
    cout<<(a + b);
    //cout<<c<<endl;
    //if(c=='+') cout<<(a + b)<<endl;
    //else if (c=='-') cout<<(a - b)<<endl;
    //else if (c=='*') cout<<(a * b)<<endl;
    //else if (c=='>') cout<<(a > b)<<endl;
    //else if (c=='<') cout<<(a < b)<<endl;
    //else if (c=='=') cout<<(a = b)<<endl;

    //}
    return 0;
    }
    ```

  • -1
    @ 2016-10-08 18:34:29
    #include<iostream>
    using namespace std;
    int main(){
        int a,b,ans=0;
        cin>>a>>b;
        for(i=0;i<a;++i){
            ++ans;
        }
        for(i=0;i<b;++i){
            ++ans;
        }
        cout<<ans;
        return 0;
    }
    
  • -1
    @ 2016-10-07 21:27:43

    var i,j,k,a,b:longint;
    begin
    readln(a,b);
    for i:=1 to 100000 do
    for j:=1 to 100000 do
    k:=1;
    writeln(a+b);
    end.
    阿,我超时了,求解

  • -1
    @ 2016-10-07 21:17:08

    var a,b:longint;
    begin
    readln(a,b);
    writeln(a+b);
    end.
    woc好难的题,我想了整整50年,终于写出了这道题

  • -1
    @ 2016-10-07 11:49:37

    Lambda大法好
    ```c++
    #include <conio.h>
    #include <stdio.h>

    int main()
    {
    int a, b;

    scanf("%d %d", &a, &b);
    printf("%d", mutable throw() -> int {return a + b}(a, b));

    getch();
    return 0;
    }
    ```

  • -1
    @ 2016-10-07 11:44:55

  • -1
    @ 2016-10-05 11:23:22

    测试数据 #0: WrongAnswer, time = 0 ms, mem = 816 KiB, score = 0

    测试数据 #1: WrongAnswer, time = 0 ms, mem = 812 KiB, score = 0

    测试数据 #2: WrongAnswer, time = 0 ms, mem = 808 KiB, score = 0

    测试数据 #3: WrongAnswer, time = 0 ms, mem = 812 KiB, score = 0

    测试数据 #4: Accepted, time = 0 ms, mem = 812 KiB, score = 10

    测试数据 #5: WrongAnswer, time = 0 ms, mem = 812 KiB, score = 0

    测试数据 #6: WrongAnswer, time = 0 ms, mem = 816 KiB, score = 0

    测试数据 #7: WrongAnswer, time = 0 ms, mem = 812 KiB, score = 0

    测试数据 #8: WrongAnswer, time = 0 ms, mem = 808 KiB, score = 0

    测试数据 #9: WrongAnswer, time = 0 ms, mem = 812 KiB, score = 0

    WrongAnswer, time = 0 ms, mem = 816 KiB, score = 10

    var a,b:longint;
    begin
    randomize;
    readln(a,b);
    writeln(a+b+random(50));
    end.

  • -1
    @ 2016-08-13 18:52:35

    #include<cstdio>
    int main()
    {
    int a,b;scanf("%d%d",&a,&b);
    while (!a^b&&b)
    {
    int tmp=a;
    a^=b;
    b=(tmp&b)<<1;
    }
    if (b) printf("%d",b);
    else printf("%d",a);
    }
    2333

  • -1
    @ 2016-08-09 20:13:24
    #include <iostream>
    using namespace std;
    class A
    {
    public :
    inline void func(int,int);
    inline void print();
    private :
    int i,j;
    };
    int main()
    {
    A a;
    int q,w;
    cin >> q >> w;
    a.func(q,w);
    a.print();
    return 0;
    }
    void A::func(int x,int y)
    {
    i=x;
    j=y;
    }
    void A::print()
    {
    cout << i+j << endl;    
    }
    

    noiopenjudge手打测试后发过来……

  • -1
    @ 2016-08-09 16:57:46
    
    #include <iostream>
    using namespace std;
    int main()
    {
        int a,b;
        cin >> a >> b;
        cout << a+ b << endl;
        return 0;
    }
    
  • -1
    @ 2016-08-07 15:19:02
    var a,b:longint;
    begin
     read(a,b);
     write(a+b);
    end.
    

    测试数据 #0: Accepted, time = 0 ms, mem = 804 KiB, score = 10
    测试数据 #1: Accepted, time = 0 ms, mem = 800 KiB, score = 10
    测试数据 #2: Accepted, time = 0 ms, mem = 800 KiB, score = 10
    测试数据 #3: Accepted, time = 0 ms, mem = 800 KiB, score = 10
    测试数据 #4: Accepted, time = 0 ms, mem = 804 KiB, score = 10
    测试数据 #5: Accepted, time = 15 ms, mem = 800 KiB, score = 10
    测试数据 #6: Accepted, time = 0 ms, mem = 800 KiB, score = 10
    测试数据 #7: Accepted, time = 0 ms, mem = 800 KiB, score = 10
    测试数据 #8: Accepted, time = 0 ms, mem = 804 KiB, score = 10
    测试数据 #9: Accepted, time = 15 ms, mem = 800 KiB, score = 10
    Accepted, time = 30 ms, mem = 804 KiB, score = 100

  • -1
    @ 2016-08-01 21:27:16
    #include <assert.h>
    #include<iostream>
    #include <errno.h>
    #include <limits.h>
    #include <locale.h>
    #include <math.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <time.h>
    #include <wchar.h>
    #include <wctype.h>
    #include <algorithm>
    #include <bitset>
    #include <cctype>
    #include <cerrno>
    #include <clocale>
    #include <cmath>
    #include <complex>
    #include <cstdio>
    #include <cstdlib>
    #include <cstring>
    #include <ctime>
    #include <deque>
    #include <exception>
    #include <fstream>
    #include <functional>
    #include <limits>
    #include <list>
    #include <map>
    #include <iomanip>
    #include <ios>
    #include <iosfwd>
    #define boom return
    #define _233 int
    #define hh cin
    #define _2333 for
    using namespace std;
    int dfs(int x,int y)
    {
        
        if(1)
        boom y==0?x:dfs(x+1,y-1);
        
    }
    int main()
    {
        _233 a,b,ans=dfs(0,0);
        hh>>a>>b;
        ans=dfs(a,b);
        int nums[1010],lon=dfs(0,0);
        while(ans>0)
        {
            nums[++lon]=ans%10;
            ans/=10;
        }
        int num[1010];
        memset(num,dfs(0,0),sizeof(num));
        _2333(int j=1;j<=lon;j++)
        {
            num[lon-j+1]=nums[j];
        }
        _2333(int k=1;k<=lon;k++)
        cout<<num[k];
        dfs(1,1);
        boom 0;
    }
    
  • -1
    @ 2016-08-01 21:25:10
    #include <assert.h>
    #include <errno.h>
    #include <iostream>
    #include <limits.h>
    #include <locale.h>
    #include <math.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <time.h>
    #include <wchar.h>
    #include <wctype.h>
    #include <algorithm>
    #include <bitset>
    #include <cctype>
    #include <cerrno>
    #include <clocale>
    #include <cmath>
    #include <complex>
    #include <cstdio>
    #include <cstdlib>
    #include <cstring>
    #include <ctime>
    #include <deque>
    #include <exception>
    #include <fstream>
    #include <functional>
    #include <limits>
    #include <list>
    #include <map>
    #include <iomanip>
    #include <ios>
    #include <iosfwd>
    #define Plus cout<<a+b
    #define Cin cin>>a>>b
    #define Int int a,b 
    #define wo_233 return 0
    using namespace std;
    int main()
    {
        Int;
        Cin;
        Plus;
        wo_233;
    }
    
  • -1
    @ 2016-08-01 21:23:42

    #include <assert.h>
    #include <errno.h>
    #include <iostream>
    #include <limits.h>
    #include <locale.h>
    #include <math.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <time.h>
    #include <wchar.h>
    #include <wctype.h>
    #include <algorithm>
    #include <bitset>
    #include <cctype>
    #include <cerrno>
    #include <clocale>
    #include <cmath>
    #include <complex>
    #include <cstdio>
    #include <cstdlib>
    #include <cstring>
    #include <ctime>
    #include <deque>
    #include <exception>
    #include <fstream>
    #include <functional>
    #include <limits>
    #include <list>
    #include <map>
    #include <iomanip>
    #include <ios>
    #include <iosfwd>
    #define Plus cout<<a+b
    #define Cin cin>>a>>b
    #define Int int a,b
    #define wo_233 return 0
    using namespace std;
    int main()
    {
    Int;
    Cin;
    Plus;
    wo_233;
    }

  • -1
    @ 2016-08-01 21:20:40

    #include <assert.h>
    #include<iostream>
    #include <errno.h>
    #include <limits.h>
    #include <locale.h>
    #include <math.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <time.h>
    #include <wchar.h>
    #include <wctype.h>
    #include <algorithm>
    #include <bitset>
    #include <cctype>
    #include <cerrno>
    #include <clocale>
    #include <cmath>
    #include <complex>
    #include <cstdio>
    #include <cstdlib>
    #include <cstring>
    #include <ctime>
    #include <deque>
    #include <exception>
    #include <fstream>
    #include <functional>
    #include <limits>
    #include <list>
    #include <map>
    #include <iomanip>
    #include <ios>
    #include <iosfwd>
    #define boom return
    #define _233 int
    #define hh cin
    #define _2333 for
    using namespace std;
    int dfs(int x,int y)
    {

    if(1)
    boom y==0?x:dfs(x+1,y-1);

    }
    int main()
    {
    _233 a,b,ans=dfs(0,0);
    hh>>a>>b;
    ans=dfs(a,b);
    int nums[1010],lon=0 ;
    while(ans>0)
    {
    nums[++lon]=ans%10;
    ans/=10;
    }
    int num[1010];
    memset(num,dfs(0,0),sizeof(num));
    _2333(int j=1;j<=lon;j++)
    {
    num[lon-j+1]=nums[j];
    }
    _2333(int k=1;k<=lon;k++)
    cout<<num[k];
    dfs(1,1);
    boom 0;
    }

  • -1
    @ 2016-07-29 22:25:00
    
    include<stdio.h> include<stdlib.h>
    
    int main()
    {
    int a,b;
    scanf("%d %d",&a,&b);
    printf("%d",a+b);
    return 0;
    }
    

信息

ID
1000
难度
9
分类
(无)
标签
(无)
递交数
73497
已通过
28188
通过率
38%
被复制
200