Files
C_code/exercise/2.c
T

51 lines
934 B
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 题目描述
// 给定一个只包括()
// {} [] 的字符串
// s
// s ,判断字符串是否有效。
// 有效字符串需满足:
// 左括号必须用相同类型的右括号闭合。
// 左括号必须以正确的顺序闭合。
// 每个右括号都有一个对应的相同类型的左括号。
// 输入
// 输入一个字符串
// s
// (
// 1
// ≤ s
// ≤ 10 4)
// s(1≤s≤10 4)。
// 输出
// 有效字符串输出 true,否则输出 false。
// 样例
// 输入 #1 复制代码()
// 输出 #1 复制代码
// true 输入 #2 复制代码()[]
// {
// }
// 输出 #2
// 复制代码
// true
// 输入 #3
// 复制代码
// (]
// 输出 #3
// 复制代码
// false
// 输入 #4
// 复制代码
// ([])
// 输出 #4
// 复制代码
// true
// 输入 #5
// 复制代码
// ()[{]}
// 输出 #5
// 复制代码
//