fork download
  1. import java.io.IOException;
  2. import java.util.Scanner;
  3.  
  4. public class Main {
  5. public static void main(String[] args) throws IOException {
  6.  
  7. Scanner scan = new Scanner(System.in);
  8. int number = scan.nextInt();
  9.  
  10. int result = 0;
  11.  
  12. for (int i = 0; i < number; i++) {
  13. result += System.in.read() - '0';
  14. }
  15. System.out.println(result);
  16. }
  17. }
Success #stdin #stdout 0.14s 51660KB
stdin
1
1
stdout
-49