資料結構實驗之棧與佇列四 括號匹配

2021-08-28 21:20:03 字數 808 閱讀 9364

time limit: 1000 ms memory limit: 65536 kib

submit

statistic

problem description

給你一串字元,不超過50個字元,可能包括括號、數字、字母、標點符號、空格,你的任務是檢查這一串字元中的( ) ,[ ],是否匹配。

input

輸入資料有多組,處理到檔案結束。

output

如果匹配就輸出「yes」,不匹配輸出「no」

sample input

sin(20+10)

]

sample output

yes

no

hint

source

ma6174

#include#include#includestruct st

;int main()

else if(s[i]==')')

else if(l->data[l->top]=='(')

else

}else if(s[i]=='}')

else if(l->data[l->top]=='

else

}else if(s[i]==']')

else if(l->data[l->top]=='[')

else}}

if(l->top==-1)

printf("yes\n");

else printf("no\n");

}return 0;

}

資料結構實驗之棧與佇列四 括號匹配

time limit 1000ms memory limit 65536kb submit statistic problem description 給你一串字元,不超過50個字元,可能包括括號 數字 字母 標點符號 空格,你的任務是檢查這一串字元中的 是否匹配。input 輸入資料有多組,處理到...

資料結構實驗之棧與佇列四 括號匹配

problem description 給你一串字元,不超過50個字元,可能包括括號 數字 字母 標點符號 空格,你的任務是檢查這一串字元中的 是否匹配。input 輸入資料有多組,處理到檔案結束。output 如果匹配就輸出 yes 不匹配輸出 no example input sin 20 10...

資料結構實驗之棧與佇列四 括號匹配

problem description 給你一串字元,不超過50個字元,可能包括括號 數字 字母 標點符號 空格,你的任務是檢查這一串字元中的 是否匹配。input 輸入資料有多組,處理到檔案結束。output 如果匹配就輸出 yes 不匹配輸出 no example input sin 20 10...