题解 | #编排字符串#
编排字符串
https://www.nowcoder.com/practice/42c0673f04b34f66ae236a1cb7995532
#include <iostream> #include <cstdio> #include <string> #include <stack> using namespace std; int main() { int n; scanf("%d",&n); stack <string> myStack; stack <string> temp; while (n--) { // 注意 while 处理多个 case string s; cin>>s; myStack.push(s); for(int i=1;i<=4 && !myStack.empty();i++){ printf("%d=",i); cout<<myStack.top()<<" "; temp.push(myStack.top()); myStack.pop(); } cout<<endl; while(!temp.empty()){ myStack.push(temp.top()); temp.pop(); } } return 0; } // 64 位输出请用 printf("%lld")