You are on page 1of 1

package AC; import java.util.

Scanner;

public class AccountBalance { /** * ID: 1326 * Resuelto * (ENVIADO EN C++) */ static Scanner l=new Scanner(System.in); public static void main(String[] args) { int n=l.nextInt(); for (int i = 0; i < n; i++) { metodo(); } } private static void metodo() { long cant=l.nextInt(); int t=l.nextInt(); String x=""; long mont=0; for (int i = 0; i < t; i++) { x=l.next(); mont=l.nextInt(); if(x.equals("C")){ cant=cant+mont; } else{ cant=cant-mont; } } System.out.println(cant); } }

You might also like