Created
June 25, 2013 07:17
-
-
Save hiroshi-cl/5856592 to your computer and use it in GitHub Desktop.
2012年3月 冬コンテスト Problem A: Carpenter's Language [Licence: NYSL Version 0.9982]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class Main { | |
public static void main(String...args) { | |
Scanner sc = new Scanner(System.in); | |
int q = sc.nextInt(); | |
long d = 0; | |
for (int i = 0; i < q; i++) { | |
sc.next(); | |
if (sc.next().charAt(0) == '(') | |
d += sc.nextInt(); | |
else | |
d -= sc.nextInt(); | |
System.out.println(d == 0 ? "Yes" : "No"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment