You are not logged in. Please login at www.codechef.com to post your questions!

×

[closed] NZEC error in java

Can anyone find the error in following code

import java.util.; import java.io.; class petrol{ public static void main(String arg[]) { Scanner sc = new Scanner(System.in); int n; int[] i = new int[100]; int x,y,j=1; float t,s; n=sc.nextInt(); n = n*3; while(j<=n) { i[j] = sc.nextInt(); j++; } j=1; while(j<=n) { x=i[j]; y=i[j+1]; s=i[j+2]; if(x==0 && y==0) { System.out.println(0); } else { t=s/(x+y); System.out.println(t); }

        j=j+3;
    }
    }

}

asked 20 Jul '17, 21:34

abidinamdar123's gravatar image

0★abidinamdar123
-5
accept rate: 0%

closed 21 Jul '17, 10:43

vijju123's gravatar image

5★vijju123 ♦♦
15.5k12066

The question has been closed for the following reason "Question is related to ongoing contest" by vijju123 21 Jul '17, 10:43


You can't ask this question now since the contest is still going on. link to the problem is- https://www.codechef.com/ISCC2017/problems/PATROL . Please ask this question after the contest ends.

link

answered 21 Jul '17, 09:54

akashbhalotia's gravatar image

5★akashbhalotia
865214
accept rate: 10%

-1

Most probably you getting this because you have declared the size of array i 100 . I would recommend you to keep an sufficient size for example 10000+ 1 (1 for index safety) . I Hope this solves your nzec

link

answered 21 Jul '17, 03:26

sonu_628's gravatar image

4★sonu_628
4208
accept rate: 10%

Hey, the contest is still going on

(21 Jul '17, 09:53) akashbhalotia5★

@admin please see when users ask questions related to ongoing contests.

(21 Jul '17, 09:55) akashbhalotia5★

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×1,664

question asked: 20 Jul '17, 21:34

question was seen: 307 times

last updated: 21 Jul '17, 10:43