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:我能运行 但不知为什么出了 Runtime Error

Posted by ecjtuFFF at 2008-09-25 16:22:24 on Problem 1068
In Reply To:我能运行 但不知为什么出了 Runtime Error Posted by:firelandy at 2006-07-01 22:22:23
> #include <iostream.h>
> #define   MAX  20
> #define   M    10
> void newcode(int, int[]);
> 
> void newcode(int n,int datacasesstring[])
> {
> 	int i,j,b,N,k = 0;
> 	char code[2*M];
>     int  results[M];
> 
> 	for(i = 0;i < datacasesstring[0];i++)
> 	{
> 		code[k] = '(';
> 		k++;
> 	}
> 	results[0] = 1;// 解码
>     code[k-1] = '$';//匹配过的"("标记上!
>  	code[k] = ')';
>     k++;
> 	
> 	for(i = 1;i < n;i++)
> 	{
> 		for(j = 0;j < (datacasesstring[i] - datacasesstring[i - 1]);j++)
> 		{
> 			code[k] = '(';
> 			k++;
> 		}
> 		////////////////////////////////////////////解码!
> 		for(b = (k-1),N = 0;b >= 0;b--)
> 		{
> 			if(code[b]=='$')
> 			{
> 				N++;
> 			}  
> 		    if(code[b]=='(')
> 			{
> 				results[i]=N+1;
> 				code[b]='$';
> 				goto A;        //////跳出!
> 	    	}   
> 		}
> 
> A:		code[k] =')';
> 		k++;
> 	}     ////////翻译成源码!
> 
> ////////////////////////////////////////////////////////////////////////////////输出结果!
> 	for(i =0;i < n;i++)
> 		cout<<results[i]<<" ";
> 	cout<<endl;
> 
> } 
> void main()
> {
> 	int cases;
> 	int number[M];
> 	int i,j;
> 	int data[M][MAX];
>     cin>>cases;
> 	for(i =0;i <cases;i++)
> 	{
> 		cin>>number[i];
> 		for(j = 0;j < number[i];j++)
> 		{
> 			cin>>data[i][j];
> 		}
> 	}
> 	for(i = 0;i < cases;i++)
> 		newcode(number[i],data[i]);
> }

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