2016 Update
This commit is contained in:
parent
948b86eafa
commit
dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions
|
|
@ -12,7 +12,7 @@ func main() {
|
|||
// accept sequence
|
||||
var s [11]float64
|
||||
for i := 0; i < 11; {
|
||||
if _, err := fmt.Scanf("%f", &s[i]); err == nil {
|
||||
if n, _ := fmt.Scan(&s[i]); n > 0 {
|
||||
i++
|
||||
}
|
||||
}
|
||||
|
|
@ -33,6 +33,6 @@ func main() {
|
|||
}
|
||||
|
||||
func f(x float64) (float64, bool) {
|
||||
result := math.Pow(math.Abs(x), .5) + 5*x*x*x
|
||||
result := math.Sqrt(math.Abs(x)) + 5*x*x*x
|
||||
return result, result > 400
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
)
|
||||
|
||||
func f(t float64) float64 {
|
||||
return math.Sqrt(math.Abs(t)) + 5*math.Pow(t, 3)
|
||||
}
|
||||
|
||||
func main() {
|
||||
var a [11]float64
|
||||
for i := range a {
|
||||
fmt.Scan(&a[i])
|
||||
}
|
||||
for i := len(a) - 1; i >= 0; i-- {
|
||||
if y := f(a[i]); y > 400 {
|
||||
fmt.Println(i, "TOO LARGE")
|
||||
} else {
|
||||
fmt.Println(i, y)
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue