杭电 hdu 2051

Bitset:

#include<iostream>
#include<stack>
using namespace std;
int main(){
    stack<int> st;
    int n;
    while(cin>>n){
        while(n){
            st.push(n%2);
            n/=2;
        }
        while(!st.empty()){
            cout<<st.top();
            st.pop();
        }
        cout<<endl;
    }
    return 0;
}


你可能感兴趣的:(ACM,HDU,杭电,2051)