题解

1323 条题解

  • -1
    @ 2020-09-12 17:07:16
    #include<bits/stdc++.h>
    using namespace std;
    
    int a,b,c;
    
    signed main(){
        cin>>a>>b;
        c=a+b;
        cout<<c<<endl;
        return 0;
    }
    
  • -1
    @ 2020-09-06 17:39:58

    新手都能学会的简易卡常a+b

    #pragma GCC optimize(2)
    #pragma GCC optimize(3)
    #pragma GCC optimize("Ofast")
    #pragma GCC optimize("inline")
    #pragma GCC optimize("-fgcse")
    #pragma GCC optimize("-fgcse-lm")
    #pragma GCC optimize("-fipa-sra")
    #pragma GCC optimize("-ftree-pre")
    #pragma GCC optimize("-ftree-vrp")
    #pragma GCC optimize("-fpeephole2")
    #pragma GCC optimize("-ffast-math")
    #pragma GCC optimize("-fsched-spec")
    #pragma GCC optimize("unroll-loops")
    #pragma GCC optimize("-falign-jumps")
    #pragma GCC optimize("-falign-loops")
    #pragma GCC optimize("-falign-labels")
    #pragma GCC optimize("-fdevirtualize")
    #pragma GCC optimize("-fcaller-saves")
    #pragma GCC optimize("-fcrossjumping")
    #pragma GCC optimize("-fthread-jumps")
    #pragma GCC optimize("-funroll-loops")
    #pragma GCC optimize("-fwhole-program")
    #pragma GCC optimize("-freorder-blocks")
    #pragma GCC optimize("-fschedule-insns")
    #pragma GCC optimize("inline-functions")
    #pragma GCC optimize("-ftree-tail-merge")
    #pragma GCC optimize("-fschedule-insns2")
    #pragma GCC optimize("-fstrict-aliasing")
    #pragma GCC optimize("-fstrict-overflow")
    #pragma GCC optimize("-falign-functions")
    #pragma GCC optimize("-fcse-skip-blocks")
    #pragma GCC optimize("-fcse-follow-jumps")
    #pragma GCC optimize("-fsched-interblock")
    #pragma GCC optimize("-fpartial-inlining")
    #pragma GCC optimize("no-stack-protector")
    #pragma GCC optimize("-freorder-functions")
    #pragma GCC optimize("-findirect-inlining")
    #pragma GCC optimize("-fhoist-adjacent-loads")
    #pragma GCC optimize("-frerun-cse-after-loop")
    #pragma GCC optimize("inline-small-functions")
    #pragma GCC optimize("-finline-small-functions")
    #pragma GCC optimize("-ftree-switch-conversion")
    #pragma GCC optimize("-foptimize-sibling-calls")
    #pragma GCC optimize("-fexpensive-optimizations")
    #pragma GCC optimize("-funsafe-loop-optimizations")
    #pragma GCC optimize("inline-functions-called-once")
    #pragma GCC optimize("-fdelete-null-pointer-checks")
    #include<iostream>
    using namespace std;
    inline int read()
    {
        register int x=0,f=1;
        char ch=getchar();
        while(ch<'0'||ch>'9')
        {
            if(ch=='-')
                f=-1;
            ch=getchar();
        }
        while(ch>='0'&&ch<='9')
        {
            x=(x<<1)+(x<<3)+(ch^48);
            ch=getchar();
        }
        return x*f;
    }
    int main()
    {
        register int a,b;
        a=read(),b=read();
        printf("%d",a+b);
        return 0;
    }
    
  • -1
    @ 2020-09-04 22:03:28

    #include <iostream>

    using namespace std;

    int main()
    {
    int a, b;
    cin >> a >> b;
    cout << a + b << endl;
    }

  • -1
    @ 2020-08-30 11:50:05

    最简单的题?按题目模拟即可

    #include <bits/stdc++.h>
    #define INF 0x3f3f3f3f
    using namespace std;
    int a, b;
    int main()
    {
        scanf("%d %d", &a, &b);
        printf("%d", a + b);
        return 0;
    }
    
  • -1
    @ 2020-08-29 13:55:24

    #include<bits/stdc++.h>
    #define gou int main()
    #define li {
    #define guo int a,b;
    #define jia cin>>a>>b;
    #define sheng cout<<a+b;
    #define si return 0;
    #define yi }
    using namespace std;
    gou
    li
    guo
    jia
    sheng
    si
    yi

  • -1
    @ 2020-08-21 11:09:25

    C

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

    c++

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

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

  • -1
    @ 2020-08-17 20:22:37

    哇!终于找到了一道那么难的LCT题目!!!
    赶紧来写一个Link-Cut Tree题解!

    #include<iostream>
    #include<cstring>
    #include<cstdio>
    #include<cstring>
    using namespace std;
    struct node 
    {
        int data,rev,sum;
        node *son[2],*pre;
        bool judge();
        bool isroot();
        void pushdown();
        void update();
        void setson(node *child,int lr);
    }lct[233];
    int top,a,b;
    node *getnew(int x)
    {
        node *now=lct+ ++top;
        now->data=x;
        now->pre=now->son[1]=now->son[0]=lct;
        now->sum=0;
        now->rev=0;
        return now;
    }
    bool node::judge(){return pre->son[1]==this;}
    bool node::isroot()
    {
        if(pre==lct)return true;
        return !(pre->son[1]==this||pre->son[0]==this);
    }
    void node::pushdown()
    {
        if(this==lct||!rev)return;
        swap(son[0],son[1]);
        son[0]->rev^=1;
        son[1]->rev^=1;
        rev=0;
    }
    void node::update(){sum=son[1]->sum+son[0]->sum+data;}
    void node::setson(node *child,int lr)
    {
        this->pushdown();
        child->pre=this;
        son[lr]=child;
        this->update();
    }
    void rotate(node *now)
    {
        node *father=now->pre,*grandfa=father->pre;
        if(!father->isroot()) grandfa->pushdown();
        father->pushdown();now->pushdown();
        int lr=now->judge();
        father->setson(now->son[lr^1],lr);
        if(father->isroot()) now->pre=grandfa;
        else grandfa->setson(now,father->judge());
        now->setson(father,lr^1);
        father->update();now->update();
        if(grandfa!=lct) grandfa->update();
    }
    void splay(node *now)
    {
        if(now->isroot())return;
        for(;!now->isroot();rotate(now))
        if(!now->pre->isroot())
        now->judge()==now->pre->judge()?rotate(now->pre):rotate(now);
    }
    node *access(node *now)
    {
        node *last=lct;
        for(;now!=lct;last=now,now=now->pre)
        {
            splay(now);
            now->setson(last,1);
        }
        return last;
    }
    void changeroot(node *now)
    {
        access(now)->rev^=1;
        splay(now);
    }
    void connect(node *x,node *y)
    {
        changeroot(x);
        x->pre=y;
        access(x);
    }
    void cut(node *x,node *y)
    {
        changeroot(x);
        access(y);
        splay(x);
        x->pushdown();
        x->son[1]=y->pre=lct;
        x->update();
    }
    int query(node *x,node *y)
    {
        changeroot(x);
        node *now=access(y);
        return now->sum;
    }
    int main()
    {
        scanf("%d%d",&a,&b);
        node *A=getnew(a);
        node *B=getnew(b);
        //连边 Link
            connect(A,B);
        //断边 Cut
            cut(A,B);
        //再连边orz Link again
            connect(A,B);
        printf("%d\n",query(A,B)); 
        return 0;
    }
    
  • -1
    @ 2020-07-24 14:07:12
    #include <iostream>
    
    using namespace std;
    
    int main()
    {
        int a, b;
        cin >> a >> b;
        cout << a + b << endl;
    }
    
  • -1
    @ 2020-07-14 16:10:58

    都正常点!
    俗话说得好,装*遭**(光速逃
    下面是正经A+B
    C++语言

    #include <bits/stdc++.h>
    using namespace std;
    int main(){
        int a, b;
        cin >> a >> b;
        cout << a+b << endl;
        return 0;
    }
    
  • -1
    @ 2020-07-11 16:31:22
    #include <iostream>
    using namespace std;
    int main() {
        int a,b;
        cin >> a >> b;
        cout <<0;
        return 0;
    }
    
  • -1
    @ 2020-07-03 21:13:07
    #Python 管你高精不高精,a=int(input())b=int(input())print(a+b)
    a=int(input())
    b=int(input())
    print(a+b)
    

    更666:

    print(int(input())+int(input())

  • -1
    @ 2020-06-26 13:06:51

    #include<iostream>
    using namespace std;
    int n,cnt,m;
    int main(){
    cin>>n>>m;
    cout<<n+m;
    }

  • -1
    @ 2020-06-08 19:55:44

    最小生成树最好了
    ```cpp
    #include <cstdio>
    #include <algorithm>
    #define INF 2140000000
    using namespace std;
    struct tree{int x,y,t;}a[10];
    bool cmp(const tree&a,const tree&b){return a.t<b.t;}
    int f[11],i,j,k,n,m,x,y,t,ans;
    int root(int x){if (f[x]==x) return x;f[x]=root(f[x]);return f[x];}
    int main(){
    for (i=1;i<=10;i++) f[i]=i;
    for (i=1;i<=2;i++){
    scanf("%d",&a[i].t);
    a[i].x=i+1;a[i].y=1;k++;
    }
    a[++k].x=1;a[k].y=3,a[k].t=INF;
    sort(a+1,a+1+k,cmp);
    for (i=1;i<=k;i++){
    // printf("%d %d %d %d\n",k,a[i].x,a[i].y,a[i].t);
    x=root(a[i].x);y=root(a[i].y);
    if (x!=y) f[x]=y,ans+=a[i].t;
    }
    printf("%d\n",ans);
    }

  • -1
    @ 2020-06-07 16:07:49

    1

  • -1
    @ 2020-06-06 11:18:14

    再也简单不过的题了

    #include<cstdio>
    int main()
    {
        int a,b;
        scanf("%d %d",&a,&b);
      printf("%d",a+b);
    }
    
  • -1
    @ 2020-05-22 08:36:31

    各位,请不要误导新人。。。

    Python代码:

    s = input().split()
    print(int(s[0])+int(s[1]))
    
  • -1
    @ 2020-05-19 17:09:19

    递推即可

    #include<stdio.h>
    #include<stdbool.h>
    int main(){
        int a[1005],b[1005],sum[1005];
        int x,y,i;
        bool flag=0;
        scanf("%d%d",&x,&y);
        for(i=1;i<=1000;i++)a[i]=x;
        for(i=1;i<=1000;i++)b[i]=y;
        for(i=1;i<=1000;i++)sum[i]=a[i]+b[i];
        for(i=1;i<=999;i++)
            if(sum[i]!=sum[i+1]){
                printf("Impossable!");
                flag=1;
                break;
            }
        if(!flag)printf("%d",sum[1]);
        return 0;
    }
    
  • -1
    @ 2020-05-19 17:07:27

    这题得递推

    #include<stdio.h>
    #include<stdbool.h>
    int main(){
        int a[1005],b[1005],sum[1005];
        int x,y,i;
        bool flag=0;
        scanf("%d%d",&x,&y);
        for(i=1;i<=1000;i++)a[i]=x;
        for(i=1;i<=1000;i++)b[i]=y;
        for(i=1;i<=1000;i++)sum[i]=a[i]+b[i];
        for(i=1;i<=999;i++)
            if(sum[i]!=sum[i+1]){
                printf("Impossable!");
                flag=1;
                break;
            }
        if(!flag)printf("%d",sum[1]);
        return 0;
    }
    
  • -1
    @ 2020-05-12 17:15:17

    python题解水一发

    print(sum(map(int,input().split())))

信息

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