2 solutions

  • 0
    @ 2023-12-17 11:27:24

    考虑二分 即可解决

    • 0
      @ 2023-12-17 11:26:57

      #include<bits/stdc++.h>

      using namespace std;

      string s;

      int len;

      void work(int l,int r){

      int mid=(l+r)/2;
      
      cout<<s[mid];
      
      if(mid>l)work(l,mid-1);
      
      if(mid<r)work(mid+1,r);
      

      }

      int main(){

      cin>>s;
      
      len=s.size()-1;
      
      work(0,len);
      
      return 0;
      

      }

      • 1

      Information

      ID
      626
      Time
      1000ms
      Memory
      128MiB
      Difficulty
      3
      Tags
      # Submissions
      66
      Accepted
      44
      Uploaded By