Skip to content

Instantly share code, notes, and snippets.

@hiroshi-cl
Created June 25, 2013 07:17
Show Gist options
  • Save hiroshi-cl/5856592 to your computer and use it in GitHub Desktop.
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]
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