| Task: | ModAdd |
| Sender: | leosplan |
| Submission time: | 2016-09-24 14:11:10 +0300 |
| Language: | Java |
| Status: | READY |
| Result: | RUNTIME ERROR |
| test | verdict | time | |
|---|---|---|---|
| #1 | RUNTIME ERROR | 0.13 s | details |
| #2 | RUNTIME ERROR | 0.32 s | details |
| #3 | RUNTIME ERROR | 0.31 s | details |
| #4 | RUNTIME ERROR | 0.31 s | details |
| #5 | RUNTIME ERROR | 0.28 s | details |
| #6 | RUNTIME ERROR | 0.31 s | details |
| #7 | RUNTIME ERROR | 0.30 s | details |
| #8 | RUNTIME ERROR | 0.29 s | details |
| #9 | RUNTIME ERROR | 0.29 s | details |
| #10 | RUNTIME ERROR | 0.25 s | details |
Code
// A Sample Java program for beginners with Competitive Programming
import java.util.*;
import java.lang.*;
import java.io.*;
class ModAdd
{
// This function returns index of element x in arr[]
static int modAdd(int a, int b)
{
String as= Integer.toString(new Integer(a));
String bs= Integer.toString(new Integer(b));
int[] aa= new int[as.length()];
int[] ba= new int[bs.length()];
for(int i=0;i<as.length();i++){
aa[i]=as.charAt(as.length()-i-1)-'0';
}
for(int i=0;i<bs.length();i++){
ba[i]=bs.charAt(bs.length()-i-1)-'0';
}
int[] res = new int[aa.length>ba.length?aa.length:ba.length];
for(int i=0;i<res.length;i++){
if(aa.length>i && ba.length>i){
res[i]=(aa[i]+ba[i])%10;
} else if(aa.length>i){
res[i]=aa[i];
} else if(ba.length>i){
res[i]=ba[i];
}
}
String result = "";
for(int i=res.length-1;i>=0;--i){
result = result + res[i];
}
return Integer.parseInt(result);
}
public static void main (String[] args)
{
// Note that size of arr[] is considered 100 according to
// the constraints mentioned in problem statement.
int[] arr = new int[2];
// Input the number of test cases you want to run
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
int n = sc.nextInt();
System.out.println(modAdd(t,n));
}
}
Test details
Test 1
Verdict: RUNTIME ERROR
| input |
|---|
| 3797629225 9766508989 |
| correct output |
|---|
| 2453127104 |
| user output |
|---|
| (empty) |
Error:
Exception in thread "main" java.util.InputMismatchException: For input string: "3797629225...
Test 2
Verdict: RUNTIME ERROR
| input |
|---|
| 552139016901047883384892240490... |
| correct output |
|---|
| 552139016901047883384892240490... |
| user output |
|---|
| (empty) |
Error:
Exception in thread "main" java.util.InputMismatchException: For input string: "5521390169...
Test 3
Verdict: RUNTIME ERROR
| input |
|---|
| 860793811134668093345482099582... |
| correct output |
|---|
| 487710306894083216377653715430... |
| user output |
|---|
| (empty) |
Error:
Exception in thread "main" java.util.InputMismatchException: For input string: "8607938111...
Test 4
Verdict: RUNTIME ERROR
| input |
|---|
| 2 870841652294197226626825161089... |
| correct output |
|---|
| 870841652294197226626825161089... |
| user output |
|---|
| (empty) |
Error:
Exception in thread "main" java.util.InputMismatchException: For input string: "8708416522...
Test 5
Verdict: RUNTIME ERROR
| input |
|---|
| 0 404905566051213252279994991040... |
| correct output |
|---|
| 404905566051213252279994991040... |
| user output |
|---|
| (empty) |
Error:
Exception in thread "main" java.util.InputMismatchException: For input string: "4049055660...
Test 6
Verdict: RUNTIME ERROR
| input |
|---|
| 430112167406460960088878635088... |
| correct output |
|---|
| 430112167406460960088878635088... |
| user output |
|---|
| (empty) |
Error:
Exception in thread "main" java.util.InputMismatchException: For input string: "4301121674...
Test 7
Verdict: RUNTIME ERROR
| input |
|---|
| 867016005819001635643395991596... |
| correct output |
|---|
| 999999999999999999999999999999... |
| user output |
|---|
| (empty) |
Error:
Exception in thread "main" java.util.InputMismatchException: For input string: "8670160058...
Test 8
Verdict: RUNTIME ERROR
| input |
|---|
| 120453771521975552204976752778... |
| correct output |
|---|
| 0 |
| user output |
|---|
| (empty) |
Error:
Exception in thread "main" java.util.InputMismatchException: For input string: "1204537715...
Test 9
Verdict: RUNTIME ERROR
| input |
|---|
| 239979749009277805816504910098... |
| correct output |
|---|
| 239979749009277805816504910098... |
| user output |
|---|
| (empty) |
Error:
Exception in thread "main" java.util.InputMismatchException: For input string: "2399797490...
Test 10
Verdict: RUNTIME ERROR
| input |
|---|
| 990963963634143754324162574923... |
| correct output |
|---|
| 818540385713473048971388312665... |
| user output |
|---|
| (empty) |
Error:
Exception in thread "main" java.util.InputMismatchException: For input string: "9909639636...
