ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1048. Superlong Sums

Help me find mistake. Java
Posted by TolyanD 21 Jan 2016 20:24
import java.util.Scanner;
public class T1048 {
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int a=sc.nextInt();
        int[] mas=new int[a];
        int[] mas1=new int[a];
        String b="";
        String b1="";

        for(int i=0;i<a;i++) {
            mas[i]=sc.nextInt();
            b+=mas[i];
            mas1[i]=sc.nextInt();
            b1+=mas1[i];
        }
        int v=Integer.parseInt(b);
        int v1=Integer.parseInt(b1);
        System.out.println(v+v1);


}}

Timus text "Runtime error" №2
Re: Help me find mistake. Java
Posted by ToadMonster 21 Jan 2016 21:43
Task:
> The first line contains a single integer N that is the length of the given integers (1 ≤ N ≤ 1 000 000)

Your code:
> int v=Integer.parseInt(b);

How many digits can be placed into int v?