题解

1219 条题解

  • 15
    @ 2018-05-01 16:13:03

    告诉你们什么叫做暴力的题解。

    #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
    
    • @ 2018-05-01 22:51:50

      #include<bits/stdc++.h>
      #define qi int main()
      #define yin
      {
      #define huo int a,b;
      #define fu cin>>a>>b;
      #define bi cout<<a+b;
      #define qu return 0;
      #define zhi
      }
      using namespace std;
      qi
      yin
      huo
      fu
      bi
      qu
      zhi

    • @ 2019-07-11 18:13:13

      学习了

    • @ 2020-05-18 20:07:53

      zzmg,jbl(

  • 4
    @ 2019-05-26 16:06:36

    来发字典树

    #include<cstdio>
    #include<cstring>
    #include<cstdlib>
    #include<algorithm>
    using namespace std;
    struct node{
        int str[26];
        int sum;
    }s[1000];
    char str1[100];
    int t=0,tot=0,ss=0;
    bool f1;
    void built()
    {
        t=0;
        for(int i=0;i<strlen(str1);i++)
        {
             if(str1[i]=='-'){
                 f1=true;continue;
             }
             if(!s[t].str[str1[i]-'0'])
             s[t].str[str1[i]-'0']=++tot;
             t=s[t].str[str1[i]-'0'];
             s[t].sum=str1[i]-'0';
        }
    }
    int query()
    {
       int t=0;int s1=0;
       for(int i=0;i<strlen(str1);i++)
       {
               if(str1[i]=='-') continue;
               if(!s[t].str[str1[i]-'0']) return s1;
               t=s[t].str[str1[i]-'0'];
               s1=s1*10+s[t].sum;
       }
       return s1;
    }
    int main()
    {    
      for(int i=1;i<=2;i++)
      {
          f1=false;
          scanf("%s",str1);
        built();
        if(f1)
          ss-=query();
          else ss+=query();
      }
      printf("%d",ss);
      return 0;    
    }
    
  • 4
    @ 2017-10-15 10:10:52
    a, b = gets.chomp.split.map(&:to_i)
    puts a + b
    

    这是ruby的题解,希望vijos能早日加上ruby的评测机qwq

  • 3
    @ 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;
    }
    
  • 3
    @ 2019-10-26 14:17:06

    本题链接:https://vijos.org/p/1000
    JieKe08的第1篇题解!

    for beginners,特设此题,^_^

    #include<bits/stdc++.h>//多美妙的万能头
    using namespace std;
    int main()
    {
        int a,b;//定义变量
        cin>>a>>b;//输入
        cout<<a+b;//输出,最后的换行可有可无
        return 0;//题目给的代码没有这个,但考试最好加上 
    }
    

    感谢您花费1分钟阅读鄙人的题解!

  • 3
    @ 2019-09-11 20:20:15
    //最简做法
    #include<cstdio>
    int main()
    {
        int a,b;
        scanf("%d%d",&a,&b);
        printf("%d",a+b);
        return 0;
    }
    
  • 3
    @ 2018-05-07 18:17:44

    这题目好难,写了几个月,不过终于AC了,开森 线段树

        #include <bits/stdc++.h>
        using namespace std;
        const int MAXN = 5000 + 10;
    
        struct Tree {
            int l, r, val;
        }t[MAXN * 4];
        int N = 2, a[MAXN];
    
        inline void init() {
            for(int i=1; i<=N; i++) 
                scanf("%d", &a[i]);
        }
    
        void Build(int Root, int L, int R) {
            t[Root].l = L;
            t[Root].r = R;
            t[Root].val = 0;
            if(L == R) {
                t[Root].val = a[L];
                return ;
            }
            int m = (L + R) >> 1;
            int Next = Root * 2;
            Build(Next, L, m);
            Build(Next+1, m+1, R);
            t[Root].val = t[Next].val + t[Next+1].val;
    
        }
    
        void Updata(int Root, int pos, int _val) {
            if(t[Root].l == t[Root].r) {
                        t[Root].val += _val;
                        return ;
                }
                int Next = Root * 2;
                int m = (t[Root].l + t[Root].r) >> 1;
                if(pos <= m) Updata(Next, pos, _val);
                else Updata(Next+1, pos, _val);
                t[Root].val = t[Next].val + t[Next+1].val;
        }
    
        int Doit(int Root, int L, int R) {
            if(t[Root].l>=L && t[Root].r<=R)
                return t[Root].val;
            int Ans = 0;
            int Next = Root * 2;
            int m = (t[Root].l + t[Root].r) >> 1;
            if(L <= m) Ans += Doit(Next, L, R);
            if(R >  m) Ans += Doit(Next+1, L, R);
            return Ans;
        }
    
        int main() {
            init();
            Build(1, 1, N);
            int Ans = Doit(1, 1, N);
            printf("%d\n", Ans);
            return 0;
        }
    
    • @ 2019-08-19 15:14:15

      你那是啥玩意?

      #include <iostream>
      
      using namespace std;
      
      int main()
      {
          int a, b;
          cin >> a >> b;
          cout << a + b << endl;
      }
      
    • @ 2019-09-22 19:57:32
      #include<cstdio>
      int main()
      {
          int a,b;
          scanf("%d%d",&a,&b);
          printf("%d",a+b);
          return 0;
      }
      
    • @ 2019-09-22 19:59:32

      @
      C++语言学习者青云
      : 我这才是

    • @ 2020-06-19 17:35:42

      @
      C++语言学习者青云
      : 那是开玩笑的

  • 2
    @ 2020-07-11 16:31:22
    #include <iostream>
    using namespace std;
    int main() {
        int a,b;
        cin >> a >> b;
        cout <<0;
        return 0;
    }
    
  • 2
    @ 2017-08-10 19:11:40

    冷清啊。。我来一发Python3的题解

    a, b = map(int, input().split())
    print(a + b)
    

    恩 就是这么简洁qwq

  • 2
    @ 2017-08-05 11:40:48
    #include <iostream>
    using namespace std;
    int main()
    {
        int a,b;
        cin>>a>>b;
        cout<<a+b;
        return 0;
    }
    
  • 2
    @ 2017-07-07 20:15:45
    #include <iostream>
    #include <string.h>
    #include <stdio.h>
    using namespace std;
    const int mx = 500000 + 100;
    struct node{
        int l,r;
        long long lazy,sum;
    }tree[mx * 4];
    int a[mx];
    /*
        Segment-Tree Gerneral Tools
        **--Using Marco--**
        Marco l(seq)
            Get left Sequence Number
        Marco r(seq)
            Get Right Sequence Number
        Marco lt(seq)
            Get Left Tree
        Marco pt(seq)
            Get Present Tree
        Marco trlen(seq)
            Get Tree Length
        Marco trmid(seq)
            Get Middle Sequence Number
    */
    #define l(seq)  seq * 2
    #define r(seq)  l(seq) + 1
    #define lt(seq) tree[l(seq)]
    #define rt(seq) tree[r(seq)]
    #define pt(seq) tree[seq]
    #define trlen(seq)  (pt(seq).r - pt(seq).l + 1)
    #define trmid(seq)  (pt(seq).r + pt(seq).l)/2
    
    void PushUp(int seq){
        pt(seq).sum = lt(seq).sum + rt(seq).sum;
    }
    void PushDown(int seq){
        if (pt(seq).lazy){
            int lz = pt(seq).lazy;
            rt(seq).lazy += lz;
            lt(seq).lazy += lz;
            rt(seq).sum += lz * trlen(r(seq));
            lt(seq).sum += lz * trlen(l(seq));
            pt(seq).lazy = 0;
        }
    }
    void Build(int l,int r,int seq){
        pt(seq).l = l;
        pt(seq).r = r;
        if (l == r){
            pt(seq).sum = a[l];
            return;
        }
        int mid = (l + r)/2;
        Build(l,mid,l(seq));
        Build(mid + 1,r,r(seq));
        PushUp(seq);
    }
    void Update(int a,int b,int alt,int seq){
        int l = pt(seq).l,
            r = pt(seq).r;
        if (l == a && b == r){
            pt(seq).lazy += alt;
            pt(seq).sum += alt * trlen(seq);
            return;
        }
        PushDown(seq);
        int mid = trmid(seq);
        if (b <= mid)
            Update(a,b,alt,l(seq));
        else if (a > mid)
            Update(a,b,alt,r(seq));
        else{
            Update(a,mid,alt,l(seq));
            Update(mid + 1,b,alt,r(seq));
        }
        PushUp(seq);
    }
    long long Query(int a,int b,int seq){
        int l = pt(seq).l,
            r = pt(seq).r;  
        if (l == a && b == r){
            return pt(seq).sum;
        }
        PushDown(seq);
        int mid = trmid(seq);
        if (b <= mid){
            return Query(a,b,l(seq));
        }
        if (a > mid)
            return Query(a,b,r(seq));
        return Query(a,mid,l(seq)) + Query(mid + 1,b,r(seq));
    }
    int main(){
        for (int i = 1;i <= 2;i++)
            scanf("%d",&a[i]);
        Build(1,2,1);
        printf("%d\n",Query(1,2,1));
        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())

  • 0
    @ 2020-07-24 14:07:12
    #include <iostream>
    
    using namespace std;
    
    int main()
    {
        int a, b;
        cin >> a >> b;
        cout << a + b << endl;
    }
    
  • 0
    @ 2020-06-06 11:18:14

    再也简单不过的题了

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

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

    Python代码:

    s = input().split()
    print(int(s[0])+int(s[1]))
    
  • 0
    @ 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;
    }
    
  • 0
    @ 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;
    }
    
  • 0
    @ 2020-05-11 08:34:59
    """
    author lyl913
    """
    a, b = input().split()
    print(int(a)+int(b))
    
    

    大致思想:

    1.输入a和b(此时是字符串形式,需要split分割)

    2.输出a+b(注意需要转换成int类型再输出)

  • 0
    @ 2020-05-10 09:11:17

    define真好用……

    #include <bits/stdc++.h>
    #define std using namespace std
    #define main int main()
    #define then ;
    #define start {
    #define integer int
    #define also ,
    #define input cin>>
    #define to >>
    #define output cout<<
    #define plus +
    #define finish return 0
    #define over }
    std then
    main 
    start
    integer a also b then
    input a to b then
    output a plus b then
    finish then
    over
    
  • 0
    @ 2020-05-09 12:05:59

    我谔谔

信息

ID
1000
难度
9
分类
(无)
标签
(无)
递交数
66192
已通过
25717
通过率
39%
被复制
69