全部评论 15

  • 看我别忘了点赞哦~

    2023-09-18 来自 浙江

    11
    • 6
      原本两三行的代码
      硬生生写到了几十行
      不愧是大佬
      (doge

      2023-09-25 来自 四川

      0
    • 就这?????????????
      #include<iostream>
      #include <algorithm>
      #include <bits/stdc++.h>
      #include <math.h>
      #include <cmath>
      #include<string>
      #include<cstring>
      #include<list>
      #include<map>
      #include<queue>
      #include<iterator>
      #include<stack>
      using namespace std;

      #define ll long long
      const int N = 1010;

      int RAND_1(ll a,ll b){
      ll n = a + b;
      return n;
      }

      int RAND_2(string a, string b, int n[500], int m[500], int ans[501]){
      for(int i = 0; i < a.size(); i++)
      n[i] = a[a.size() - i - 1] - '0';
      for(int i = 0; i < b.size(); i++)
      m[i] = b[b.size() - i - 1] - '0';
      int len_maxn = max(a.size(), b.size()) + 1;
      for(int i = 0; i < len_maxn; i++)
      {
      ans[i] = n[i] + m[i] + ans[i];
      if(ans[i] > 9)
      {
      ans[i + 1]++;
      ans[i] = ans[i] % 10;
      }
      }
      while(ans[len_maxn - 1] == 0 && len_maxn > 0) len_maxn--;
      for(int i = len_maxn - 1; i >= 0; i--) cout << ans[i];
      return 0;
      }

      int RAND_3(ll a, ll b){
      ll ans = 0;
      for(int i = 0; i < a; i ++ ) {
      ans ++;
      }
      for(int i = 0; i < b; i ++ ) {
      ans ++;
      }
      return ans;
      }

      int n[1010], m[1010],c[1010];
      int main(){
      srand(time(0));
      ll a , b;
      string z , y;
      int x;
      x = 1 + rand() % 3;
      if(x == 1){
      cin >> a >> b;
      int ans = RAND_1(a,b);
      cout << ans;
      }
      if(x == 2){
      cin >> z >> y;
      RAND_2(z , y , n , m, c);
      }
      if(x == 3){
      cin >> a >> b;
      int ans = RAND_3(a, b);
      cout << ans;
      }
      return 0;
      }

      2024-11-03 来自 广东

      0
    • (狗式点头)

      2025-01-26 来自 浙江

      0
  • 还用高精度……

    2023-09-18 来自 浙江

    2
  • 这个有意思,6

    2023-09-18 来自 浙江

    2
  • 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);

        connect(A,B);
        cut(A,B);
    
        connect(A,B);
    printf("%d\n",query(A,B)); 
    return 0;
    

    }

    2025-01-03 来自 湖南

    0
  • #include<iostream>
    #include <algorithm>
    #include <math.h>
    #include <cmath>
    #include<string>
    #include<cstring>
    #include<list>
    #include<map>
    #include<queue>
    #include<iterator>
    #include<stack>
    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 nodejudge(){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 nodeupdate(){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){

    2025-01-03 来自 湖南

    0
    • 多加点头文件吧哈哈哈
      #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>
      #include <iostream>
      #include <istream>
      #include <ostream>
      #include <queue>
      #include <set>
      #include <sstream>
      #include <stack>
      #include <stdexcept>
      #include <streambuf>
      #include <string>
      #include <utility>
      #include <vector>
      #include <cwchar>
      #include <cwctype>

      2025-02-09 来自 江苏

      0
  • 错啦

    2024-10-13 来自 广东

    0
  • 不对

    2024-10-13 来自 广东

    0
  • 可能会坑我们(doge)

    2024-09-03 来自 浙江

    0
  • 啊?

    2024-08-11 来自 广东

    0
  • #include <bits/stdc++.h>
    using namespace std;
    int main(){
        cout<<5;
    }
    

    2024-08-05 来自 浙江

    0
  • 是你题解深奥

    2024-07-26 来自 浙江

    0
  • 大佬厉害

    2024-07-25 来自 北京

    0
  • 你真聪明

    2024-03-31 来自 浙江

    0
  • 考古(原来中国原名中国人民解放军)

    2023-12-31 来自 浙江

    0
  • emm.....时间复杂度了解一下

    2023-11-01 来自 浙江

    0
首页