1 solutions

  • 0
    @ 2024-9-4 14:31:36
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
       int n;
       cin>>n;
       int t=n;
       if(n==0)
       {
          cout<<0<<endl<<0<<endl<<0;
          return 0;
       }
       stack<char> stk;
       while(n)
       {
          int cnt=n%8;
          stk.push(cnt+'0');
          n/=8;
       }
       while(stk.size())
       {
          cout<<stk.top();
          stk.pop();
       }
       cout<<endl<<t<<endl;
       while(t)
       {
          int res=t%16;
          if(res>=10)
          {
             stk.push(res-10+'a');
          }
          else
          {
             stk.push(res+'0');
          }
          t/=16;
       }
       while(stk.size())
       {
          cout<<stk.top();
          stk.pop();
       }
       return 0;
    }
    
    • 1

    Information

    ID
    134
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    1
    Tags
    (None)
    # Submissions
    22
    Accepted
    7
    Uploaded By