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

×

Getting WA in BTAR

I did the exact same thing explained in the tutorial. It's passing the sample test cases but giving WA when submitted.Please help!

Problem

My solution

asked 06 Jan '18, 18:05

ramini's gravatar image

2★ramini
615
accept rate: 8%


for testcase

1

6

2 2 4 6 3 1

Correct Output:-1

Your Code's Output:2

Why don't you find the sum of all elements first and then check whether it is divisible by 4 or not rather than checking every time

I made few adjustments to your Code

link

answered 07 Jan '18, 12:17

sagijagadish's gravatar image

4★sagijagadish
452
accept rate: 23%

edited 07 Jan '18, 12:21

toggle preview
Preview

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:

×21
×1
×1

question asked: 06 Jan '18, 18:05

question was seen: 300 times

last updated: 10 Jan '18, 13:39