| ||||||||||
| 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 | |||||||||
Re:我能运行 但不知为什么出了 Runtime ErrorIn 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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator