8 条题解
-
4杨咏诺 LV 9 @ 2017-10-31 15:18:22
stri=str(input())
left=stri.count('(')
right=stri.count(')')
if(left==right and stri[0]!=')' and stri[-1]!='('):
print("yes")
else:
print("no") -
12020-01-28 16:01:58@
a=input()
l=a.count('(')
r=a.count(')')
for i in range(0,len(a)+1):
x=a[0:i]
l2=x.count('(')
r2=x.count(')')
if l!=r or l2<r2:
print('no')
break
elif l==r and x==a:
print("yes") -
12018-10-30 18:15:50@
又一道水题
#include <stdio.h> #include <cstring> #include <iostream> using namespace std; string s; int a; int main() { cin>>s; for(int i=0;i<s.length();i++) { if(s[i]=='(')a++; else a--; } if(a==0)cout<<"yes"; else cout<<"no"; return 0; }
-
12017-11-23 16:16:31@
a=input()
b=0
front="("
back=")"
frontnum=0
backnum=0
judge=1
while(b<=len(a)-1):
if(a[b]==front):
frontnum+=1
elif(a[b]==back):
backnum+=1
if(frontnum<backnum):
judge=0
b+=1
if(frontnum!=backnum):
judge=0
if(judge==0):
print("no")
elif(judge==1):
print("yes") -
02022-04-22 08:56:39@
#河北丰润车轴山中学
a=str(input())
b=len(a)
c=q="("
d=p=')'
if a[0]==p or a[b-1]==q:
print('no')
exit()
z=0
for i in range(z,b):
c=c+'('
if a[i]==')':
for z in range(i,b):
d=d+')'
if a[z]=='(':
if len(c)==len(d):break
else:
print('no')
exit()
if z==b-1:
if len(c)==len(d)+1:
print('yes')
exit()
else:
print('no')
exit()
print('yes') -
02017-11-20 15:43:15@
a=input()
b=[]
for i in a:
if(i=="("):
b.append(i)
elif(i==")"):
if(len(b)!=0):
b.pop()
else:
print("no")
exit()
if(len(b)!=0):
print("no")
else:
print("yes") -
02017-11-02 10:48:36@
s=input()
l=len(s)
a=0
b=0
for i in range(0,l):
if(s[i]=="("):
a=a+1
else:
b=b+1
if(b>a):
break
if(a!=b):
print("no")
else:
print("yes") -
-172017-11-01 19:20:13@
)))(((
- 1
信息
- 难度
- 8
- 分类
- (无)
- 标签
- (无)
- 递交数
- 2349
- 已通过
- 479
- 通过率
- 20%
- 被复制
- 1
- 上传者