题解

1309 条题解

  • -1
    @ 2017-02-15 16:26:57

    #include <cstdio>
    int main()
    {
    int a;
    int b;
    scanf("%d %d",&a,&b);
    printf("%d",a+b);
    return 0;
    }

  • -1
    @ 2017-02-08 16:18:59
    //C Code
    #include<stdio.h>
    int a,b;
    int main(){
      scanf("%d%d",&a,&b);
      printf("%d",a+b);
    }
    
    //Cpp Code
    #include<cstdio>
    int a,b;
    int main(){
      scanf("%d%d",&a,&b);
      printf("%d",a+b);
    }
    
    //Pascal Code
    Var
      A,B:Integer;
    Begin
      Readln(A,B);
      Writeln(A+B);
    End.
    
  • -1
    @ 2017-02-07 22:42:50

    #include<iostream>
    #include<cstdio>
    #include<cstring>
    #include<queue>
    #include<algorithm>
    #include<cmath>
    #include<cstdlib>
    #include<set>
    #include<map>
    #include<cctype>
    #include<string>
    #define debug(x) cerr << #x << " = " << x << endl
    #define LL long long
    #define ULL unsigned long long
    #define MAXN 100010
    using namespace std;
    inline int read(){
    int x = 0, f = 1;
    char ch = getchar();
    for(; !isdigit(ch); ch = getchar()) if(ch == '-') f = -1;
    for(; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
    return x * f;
    }

    const int inf = 1e9 + 7;
    int n, Q;
    struct Node{
    int val, size, cnt;
    Node *pre, *ch[2];
    void update(){
    size = ch[0]->size + ch[1]->size + cnt;
    }
    int get_wh(){
    return pre->ch[0] == this ? 0 : 1;
    }
    void set_ch(int wh, Node *child);
    } pool[MAXN], *null, *root;

    void Node::set_ch(int wh, Node *child){
    ch[wh] = child;
    if(child != null) child->pre = this;
    update();
    }

    int top = 0;

    inline Node *get_new(int val){
    Node *now = pool + ++top;
    now->size = now->cnt = 1;
    now->val = val;
    now->pre = now->ch[0] = now->ch[1] = null;
    return now;
    }

    inline void rotate(Node *&now){
    Node *old_fa = now->pre, *grand = now->pre->pre;
    int wh = now->get_wh();
    old_fa->set_ch(wh, now->ch[wh ^ 1]);
    now->set_ch(wh ^ 1, old_fa);
    now->pre = grand;
    if(grand != null)
    grand->ch[grand->ch[0] == old_fa ? 0 : 1] = now;
    }

    inline void splay(Node *now, Node *tar){
    for(; now->pre != tar; rotate(now))
    if(now->pre->pre != tar)
    now->get_wh() == now->pre->get_wh() ? rotate(now->pre) : rotate(now);
    if(tar == null) root = now;
    }

    void insert(int val){
    Node *last = null, *now = root;
    Node *newnode = get_new(val);
    while(now != null){
    last = now;
    if(val == now->val){
    now->cnt++, now->size++;
    splay(now, null);
    return;
    }
    else if(val < now->val)
    now = now->ch[0];
    else
    now = now->ch[1];
    }
    if(last == null)
    root = newnode;
    else{
    if(val < now->val)
    last->set_ch(0, newnode);
    else
    last->set_ch(1, newnode);
    splay(newnode, null);
    }
    }

    inline Node *find(int val){
    Node *now = root;
    while(now != null){
    if(now->val == val)
    break;
    else if(now->val < val)
    now = now->ch[0];
    else
    now = now->ch[1];
    }
    if(now != null) splay(now, null);
    return now;
    }

    void del(int val){
    Node *now = find(val);
    if(now == null) return;
    if(now->cnt > 1){
    now->cnt--;
    now->size--;
    return;
    }
    if(now->ch[0] == null && now->ch[1] == null)
    root = null;
    else if(now->ch[0] == null){
    now->ch[1]->pre = null; root = now->ch[1];
    }
    else if(now->ch[1] == null){
    now->ch[0]->pre = null; root = now->ch[0];
    }
    else{
    Node *_ = now->ch[0];
    while(_->ch[1] != null) _ = ->ch[1];
    splay(
    , now);
    _->set_ch(1, now->ch[1]);
    _->pre = null;
    root = _;
    }
    }

    inline int pre(int val){
    Node *now = root;
    int ans = -inf;
    while(now != null){
    if(now->val < val){
    ans = max(ans, now->val);
    now = now->ch[1];
    }
    else
    now = now->ch[0];
    }
    return ans;
    }

    inline int nxt(int val){
    Node *now = root;
    int ans = inf;
    while(now != null){
    if(now->val > val){
    ans = min(ans, now->val);
    now = now->ch[0];
    }
    else
    now = now->ch[1];
    }
    return ans;
    }

    inline int get_rank(int val){
    Node *now = root;
    int left = 0;
    while(now != null){
    if(val == now->val){
    int ans = left + now->ch[0]->size + 1;
    splay(now, null);
    return ans;
    }
    else if(val < now->val)
    now = now->ch[0];
    else{
    left += now->ch[0]->size + now->cnt;
    now = now->ch[1];
    }
    }
    return -1;
    }

    inline int kth(int k){
    Node *now = root;
    int left = 0;
    while(now != null){
    int _ = left + now->ch[0]->size;
    if(_ + 1 <= k && k <= _ + now->cnt){
    splay(now, null);
    return now->val;
    }
    else if(k <= _)
    now = now->ch[0];
    else
    left += now->ch[0]->size + now->cnt, now = now->ch[1];
    }
    return -1;
    }

    int main(){
    null = pool;
    null->size = null->cnt = null->val = 0;
    null->ch[0] = null->ch[1] = null->pre = null;
    root = null;
    Q = read();
    while(Q--){
    int opt = read(), x = read();
    switch(opt) {
    case 1:
    insert(x);
    break;

    case 2:
    del(x);
    break;
    case 3:
    cout << get_rank(x) << endl;
    break;
    case 4:
    cout << kth(x) << endl;
    break;
    case 5:
    cout << pre(x) << endl;
    break;
    case 6:
    cout << nxt(x) << endl;
    break;
    }
    }
    return 0;
    }

  • -1
    @ 2017-02-06 17:16:04

    #include<iostream>
    #include<cstdio>
    #include<cstring>
    #include<algorithm>
    #include<queue>
    #include<set>
    #include<map>
    #include<cmath>
    #include<string>
    #include<cctype>
    #define debug(x) cerr << #x << " = " << x << endl
    #define LL long long
    #define MAXN 210
    using namespace std;
    int read(){
    int x = 0, f = 1;
    char ch = getchar();
    for(; !isdigit(ch); ch = getchar()) if(ch == '-') f = -1;
    for(; isdigit(ch); ch = getchar()) x = x * 10 + ch -'0';
    return x * f;
    }

    const int inf = 1e9 + 7;
    int n, r[MAXN], s, t;
    struct CCM{int t, ne, l;
    void clear(){
    ne = -1;
    }
    } e[MAXN];
    int v[MAXN], num = -1;
    int dep[MAXN], cur[MAXN];
    int ans;

    void add(int x, int y, int l){
    e[++num].t = y, e[num].ne = v[x], e[num].l = l, v[x] = num;
    }

    int q[MAXN * MAXN];
    bool bfs(){
    memset(dep, 0, sizeof dep);
    int head = 0, tail = 1;
    q[1] = s, dep[s] = 1;
    for(int i = 1; i <= n; i++) cur[i] = v[i];
    int x;
    while(head < tail){
    x = q[++head];
    for(int i = v[x]; i != -1; i = e[i].ne)
    if(!dep[e[i].t] && e[i].l){
    dep[e[i].t] = dep[x] + 1;
    q[++tail] = e[i].t;
    }
    }
    if(dep[t]) return 1;
    return 0;
    }

    int dfs(int x, int t, int lim){
    if(!lim || x == t) return lim;
    int flow = 0, f;// debug(lim);
    for(int i = cur[x]; i != -1; i = e[i].ne){
    cur[x] = i; //if(x == s) debug(e[i].l);
    if(dep[e[i].t] == dep[x] + 1 && (f = dfs(e[i].t, t, min(e[i].l, lim)))){
    flow += f;
    lim -= f;
    e[i].l -= f;
    e[i ^ 1].l += f;
    if(!lim) break;
    }
    }
    return flow;
    }

    int idx(int x){
    return n + x;
    }

    int main(){
    memset(v, -1, sizeof v);
    for(int i = 1; i <= MAXN; i++) e[i].clear();
    n = read();
    s = 2 * n + 1, t = 2 * n + 2;
    for(int i = 1; i <= n; i++) r[i] = read();
    for(int i = 1, x; i <= n; i++)
    for(int j = 1; j <= r[i]; j++)
    x = read(), add(i, idx(x), inf), add(idx(x), i, 0);
    for(int i = 1; i <= n; i++)
    add(s, i, 1), add(i, s, 0), add(idx(i), t, 1), add(t, idx(i), 0);
    for(int i = v[s]; i != -1; i = e[i].ne) debug(e[i].l);
    while(bfs()) ans += dfs(s, t, inf);
    cout << ans << endl;
    return 0;
    }

  • -1
    @ 2017-01-31 10:32:00

    #include <iostream>
    using namespace std;
    int main()
    {
    int a, b;
    cin >> a >> b;
    cout << a + b << endl;
    return 0;
    }

  • -1
    @ 2017-01-25 11:23:57

    走一波面向对象的A+B。
    <pre>
    #include <bits/stdc++.h>

    using namespace std;

    class Something
    {
    friend istream & operator>>(istream & is, Something & as);
    friend ostream & operator<<(ostream & os, Something & as);
    public:
    int a, b;
    int sum(int x, int y);
    Something & operator+(int z);
    Something & operator+(Something b);

    };

    istream & operator>>(istream & is, Something & as)
    {
    is >> as.a;
    return is;
    }

    ostream & operator<<(ostream & os, Something & as)
    {
    os << as.a;
    return os;
    }

    int Something::sum(int x, int y)
    {
    return x + y;
    }

    Something & Something::operator+(int z)
    {
    a += z;
    return *this;
    }

    Something & Something::operator+(Something b)
    {
    a += b.a;
    return *this;
    }

    int main(int argc, char const *argv[])
    {
    Something sd, st;
    cin >> sd >> st;
    cout << sd + st;
    return 0;
    }
    </pre>

  • -1
    @ 2017-01-22 14:12:30

    #include<iostream> //基础头文件
    using namespace std; //自定义函数
    int main() //输入命令
    {
    int a,b=0,n=2; //1.定义a,用来输入两个数。 2.定义b,用来计数输入的两个数。 3.定义n,用来循环2次。
    for(int i=1;i<=n;i++) //开始循环,循环次数n,n=2
    {
    cin>>a; //输入a;经循环共两次
    b+=a; //计数,为了方便统计,输出时直接把b输出。
    } //循环结束。
    cout<<b; //输出循环后的结果。
    return 0;
    }

  • -1
    @ 2017-01-18 17:51:33
    #include <stdio.h>
    int main()
    {
        int a, b;
        scanf("%d%d", &a, &b);
        printf("%d\n", a + b);
        return 0;
    }
    
  • -1
    @ 2017-01-07 11:36:37
        #include <iostream>
        using namespace std;
        int main()
        {
        int a, b;
        cin >> a >> b;
        cout << a + b << endl;
        return 0;
        }
    
  • -1
    @ 2016-12-26 23:24:08

    #include <stdio.h>
    int main()
    {
    int a, b;
    scanf("%d%d", &a, &b);
    printf("%d\n", a + b);
    return 0;
    }

  • -1
    @ 2016-12-14 13:15:12
    #include<cstdio>
    #include<cstring>
    #include<iostream>
    using namespace std;
    char a1[10000],b1[10000];int a[10000],b[10000],c[10000],x=0,lena,lenb,lenc=1,i;
    int main()
    {
        scanf("%s",a1);scanf("%s",b1);lena=strlen(a1);lenb=strlen(b1);
        for(i=0;i<=lena-1;i++) a[lena-i]=a1[i]-'0';
        for(i=0;i<=lenb-1;i++) b[lenb-i]=b1[i]-'0';
        while(lenc<=lena||lenc<=lenb)
        {
            c[lenc]=a[lenc]+b[lenc]+x;
            x=c[lenc]/10;
            c[lenc]%=10;
            lenc++;
        }
        if(0==(c[lenc]=x)) lenc--;
        for(i=lenc;i>=1;i--) cout<<c[i];return 0;
    }
    
  • -1
    @ 2016-12-03 16:56:18

    #include <iostream>
    using namespace std;
    int main()
    {
    int a,b;
    cin>>a>>b;
    cout<<a+b;
    return 0;
    }

  • -1
    @ 2016-12-02 14:03:11

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

  • -1
    @ 2016-11-18 07:48:36

    好难啊

  • -1
    @ 2016-11-17 10:55:11
    #include <cstdio>
    int main() {
      int a,b;
      scanf("%d%d",&a,&b);
      printf("%d",a+b+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-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1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1);
      return 0;
    }
    
  • -1
    @ 2016-11-13 21:55:38

    这也太难了,巴巴爸爸爸爸,。从来没做过这样的题

  • -1
    @ 2016-11-06 19:53:32
    var
    a,b,i,c,k,ans,x,fu:longint;
    s1,s2,s3,ts:string;
    begin
            readln(a,b);  fu:=0;
            if (a<0) or (b<0) then  fu:=1;      //两个数有一个是负数时
            if (a<0) and (b<0) then fu:=2;    //两个数都是负数时
            while a<>0 do           //把a转换成二进制数,存在s1里(存的是绝对值)
            begin
                    if a mod 2=0 then       s1:='0'+s1
                    else    s1:='1'+s1;
                    a:=a div 2;
            end;
            while b<>0 do               //把b转成二进制数,存在s2里(存的是绝对值)
            begin
                    if b mod 2=0 then       s2:='0'+s2
                    else    s2:='1'+s2;
                    b:=b div 2;
            end;
            if length(s1)<length(s2) then             //在s1内存上较长的字符
            begin
                    ts:=s1; s1:=s2; s2:=ts;
            end;
            while length(s2)<>length(s1) do s2:='0'+s2;         //补上前置零
            if s1<s2 then                              //若s1,s2本就长度相等,在s1内存较大的一个
            begin
                    ts:=s1; s1:=s2; s2:=ts;
            end;
            if (fu=0) or (fu=2) then    for i:=1 to length(s1) do                //a,b同号,进行绝对值相加
                    s3:=s3+chr(ord(s1[i])+ord(s2[i])-48);
            if fu=1 then    for i:=1 to length(s1) do                             //a,b异号,进行绝对值相减
                    s3:=s3+chr(ord(s1[i])-ord(s2[i])+48);
            s3:='0'+s3;                             //在s3上补上一个前置零,进行进位和借位操作
            for i:=length(s3) downto 2 do
            begin
                    while ord(s3[i])>=50 do                  //进位操作
                    begin
                            s3[i-1]:=chr(ord(s3[i-1])+1);
                            s3[i]:=chr(ord(s3[i])-2);
                    end;
                    while ord(s3[i])<48 do                     //借位操作
                    begin
                            s3[i-1]:=chr(ord(s3[i-1])-1);
                            s3[i]:=chr(ord(s3[i])+2);
                    end;
            end;
            while s3[1]='0' do      Delete(s3,1,1);                 //删掉所有的前缀零
            k:=1; ans:=0;
            for i:=length(s3) downto 1 do                 //将二进制字符串转成十进制
            begin
                    x:=ord(s3[i])-48;
                    if x=1 then     ans:=ans+k;
                    k:=k*2;
            end;
            if fu=2 then    ans:=-ans;                  //如果同负则输出相反数
            writeln(ans);
    end.
    
  • -1

    #include <iostream>
    using namespace std;
    int main()
    {
    int a, b;
    cin >> a >> b;
    cout << a + b << endl;
    return 0;
    }

  • -1
    @ 2016-10-31 21:44:34

    无语。。这太水了,,难度9?Pascal5行代码就够了。。大家别想多.
    var
    a,b:longint; 定义两个大一点的数
    begin
    readln(a,b); 读入两个数
    writeln(a+b); 直接输出他们的和
    end;
    千万别想太多。!!!

  • -1
    @ 2016-10-30 21:52:42

    #include <iostream>
    using namespace std;
    int main()
    {
    int a, b;
    cin >> a >> b;
    cout << a + b << endl;
    return 0;
    }

信息

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