文章

246

粉丝

0

获赞

1172

访问

56.4k

头像
栈 题解:
P1110 中国科学技术大学机试题
发布于2026年3月16日 16:43
阅读数 94

#include<iostream>
#include<stack>
using namespace std;

int n;
stack<int> st;

int main()
{
    cin>>n;
    while(n)
    {
        st.push(n%2);
        n/=2;
    }
    while(!st.empty())
    {
        cout<<st.top();
        st.pop();
    }
    return 0;
}

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发