Dreamer


私信TA

用户名:cxk521

访问量:1650

签 名:

努力做梦!Coding startup!

等  级
排  名 1347
经  验 2847
参赛次数 5
文章发表 4
年  龄 0
在职情况 学生
学  校 长春科技学院
专  业

  自我简介:

解题思路:STL算法利用栈先进后出的特点

注意事项:栈输出时先s.top()再s.pop()因为s.pop()无返回值

参考代码:

#include <bits/stdc++.h>
using namespace std;
stack<int> s;
int main()
{	int n;	
        cin >> n;	
        while (n)
	{		
	    s.push(n % 8);		
	    n /= 8;
	}	
	while (!s.empty())
	{		
	    cout << s.top();		
	    s.pop();
	}	
	    return 0;
}


 

0.0分

8 人评分

  评论区

作者的代码转换工具是啥呢
2021-09-26 11:50:17
  • «
  • 1
  • »