Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
为什么一直运行出错??不明白啊!!求大神赐教代码: #include <iostream> #include <string> using namespace std; int main() { int t; cin >> t; while(t--) { int n; cin >> n; int a[101], b[101], k=0, g, q=0, x, y; string s; for(int i=0; i<n; i++) { cin >> a[i]; g = k; for(int t=k+i; t<i+a[i]; t++, k++) s[t] = '('; s[k+i] = ')'; for(int t=k+i-1, x=1, y=0; t>=0; t--) { if( s[t]=='(' ) y++; else x++; if(x==y) { b[q++] = x; break; } } } for(int i=0; i<n-1; i++) cout << b[i] << " "; cout << b[n-1] << endl; } return 0; } 数组开的不小的,一直提交都是运行错误,自己电脑上测试没发现问题,哪位大神帮帮忙看下 Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator