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

×

Time limit exceeded but code is the most efficient it can be AND linear. (INTEST)

package main
import (
    "fmt"
)

func main() {
    var n, k, t, i, count int
    fmt.Scanln(&n, &k)
    for i = 0; i < n; i++ {
        fmt.Scanln(&t)
        if t % k == 0 {
            count++
        }
    }
    fmt.Println(count)
}

Why is this simple linear efficient code exceeding the 8 second time limit?

asked 03 May '15, 06:43

shadowri5ing's gravatar image

0★shadowri5ing
1
accept rate: 0%

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:

×856
×266
×49

question asked: 03 May '15, 06:43

question was seen: 604 times

last updated: 03 May '15, 06:43