Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:为什么一直运行出错??不明白啊!!求大神赐教

Posted by sysu_ysx at 2015-10-14 22:36:38 on Problem 1068
In Reply To:为什么一直运行出错??不明白啊!!求大神赐教 Posted by:duchengyi at 2015-07-26 11:35:06
> 代码:
> #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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator