5 条题解

  • 0
    @ 2024-7-5 11:52:49

    #include<bits/stdc++.h>

    using namespace std;

    typedef long long ll;

    const int N=1e6+10;

    ll a[N],t[N];

    ll n,m,s;

    void liu(ll x){

    if(x==n)s++;

    if(x>=n)return;

    for(int i=1;i<=m;i++){

    liu(x+i);

    }

    }

    int main(){

    cin>>n>>m;

    liu(0);

    cout<<s;

    }

    • 0
      @ 2024-7-3 10:08:20

      #include<bits/stdc++.h>

      using namespace std;

      typedef long long ll;

      const int N=1e6+10;

      ll a[N],t[N];

      ll n,ans;

      void pai(ll x,ll y){

      if(x==y)return ;

      ll mid=(x+y)>>1;

      pai(x,mid);

      pai(mid+1,y);

      ll i=x,j=mid+1,k=x;

      while(i<=mid&&j<=y){

      if(a[i]<=a[j]) {

      t[k++]=a[i++];

      }

      else{

      t[k++]=a[j++];

      }

      }

      while(i<=mid){

      t[k++]=a[i++];

      }

      while(j<=y){

      t[k++]=a[j++];

      }

      for(int i=x;i<=y;i++){

      a[i]=t[i];

      }

      }

      int main(){

      cin>>n;

      for(int i=1;i<=n;i++) {

      cin>>a[i];

      }

      pai(1,n);

      for(int i=1;i<=n;i++){

      cout<<a[i]<<" ";

      }

      return 0;

      }

      • -2
        @ 2024-2-3 15:19:17

        6

        • -3
          @ 2024-8-14 9:27:09

          正确的代码

        • -3
          @ 2024-3-17 11:06:55

          6

          • 1

          信息

          ID
          1099
          时间
          1000ms
          内存
          256MiB
          难度
          10
          标签
          递交数
          29
          已通过
          0
          上传者