12403 - Save Setu

All about problems in Volume 124. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
New poster
Posts: 1
Joined: Tue May 26, 2015 9:06 pm

runtime error

Post by samikuet »

12403 - Save Setu

I am getting runtime error , but can't find out the reason, i have checked for many inputs and they are ok, but runtime error after submissioin.

code is...

Code: Select all

package setu_main;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

 class Main {

	 static void main(String[] args) throws IOException {
		BufferedReader rd=new BufferedReader(new InputStreamReader(System.in));
		String s=rd.readLine();
		int x=Integer.parseInt(s);
		long  res=0;
		for(int i=0;i<x;i++){
			String k=rd.readLine();
			String[] sp=k.split("\\s+");
			long amount=Long.parseLong(sp[1]);

Last edited by brianfry713 on Fri Jun 19, 2015 7:16 am, edited 1 time in total.
Reason: Added code blocks

New poster
Posts: 18
Joined: Tue Jun 17, 2014 9:32 pm
Location: Hyderabad, India

Re: runtime error

Post by predicate »

your code fails at the following input:

Code: Select all

   donate    1000
 donate 500

Post Reply

Return to “Volume 124 (12400-12499)”