Train Problem I Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 31758 Accepted Submission(s): 11976 Problem Description As the new term comes, the Ignatius Train Station is very busy nowadays…
思路:刚开始用STL中的栈,一直RE……,之后改为手动模拟栈操作,在注意点细节就可以了!!! 代码如下: #include<cstdio> #include<cstring> #include<algorithm> #define M 1000001 using namespace std; int A[M],B[M],a[M],s[M],cur,x,q,l,r; char c; int main() { while(scanf("%d",&…
Problem Description As the new term comes, the Ignatius Train Station is very busy nowadays. A lot of student want to get back to school by train(because the trains in the Ignatius Train Station is the fastest all over the world ^v^). But here comes…
三.用LinkedList来模拟栈数据结构的集合 /* * 自定义一个数据结构为LinkedList的集合类*/public class MyCollection_LinkedList { public LinkedList linkedList; public MyCollection_LinkedList() { //在构造方法里初始化 linkedList= new LinkedList(); }…
题目链接 Counting Offspring Time Limit: 15000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1757 Accepted Submission(s): 582 Problem Description You are given a tree, it’s root is p, and the node is numbered fr…
Stack is one of the most fundamental data structures, which is based on the principle of Last In First Out (LIFO). The basic operations include Push (inserting an element onto the top position) and Pop (deleting the top element). Now you are supposed…
Train Problem I Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 17589 Accepted Submission(s): 6571 Problem Description As the new term comes, the Ignatius Train Station is very busy nowadays…
https://www.luogu.org/problemnew/show/P1739 虽然应该是用栈的……但是直接模拟就可以了. #include<bits/stdc++.h> using namespace std; #define ll long long ]; int main(){ fgets(s,,stdin); int n=strlen(s); ; ;i<n;i++){ if(s[i]=='(') cntl++; else if(s[i]==')'){ ){ printf(…
//#define LOCAL #include<cstdio> #include<cstring> #include<cstdlib> #include<stack> using namespace std; ; stack<int>train; int ss[maxn]; int main() { #ifdef LOCAL freopen("test.in","r",stdin); #endif int…