This commit is contained in:
HuangHai
2025-08-30 18:35:01 +08:00
commit 1f397eca87
6258 changed files with 1487241 additions and 0 deletions

22
LuoGu/RuMen/P1307.cpp Normal file
View File

@@ -0,0 +1,22 @@
#include<bits/stdc++.h>
using namespace std;
stack<char> p;
int main() {
char c;
while (cin >> c) {
if (c == '-')cout << ("-");//判断正负,如果是负就直接输出,不压栈
else p.push(c);//否则压进栈里
}
//有多少个删除掉多少个
while (p.top() == '0')//删除前导0
p.pop();
//输出
while (!p.empty())//最后输出反转数
{
cout << p.top();
p.pop();
}
return 0;
}