mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
926 B
60 lines
926 B
5 years ago
|
package main
|
||
|
|
||
5 years ago
|
import (
|
||
5 years ago
|
student "student"
|
||
|
|
||
4 years ago
|
"github.com/01-edu/public/go/tests/lib"
|
||
5 years ago
|
)
|
||
5 years ago
|
|
||
|
func nauuo(plus, minus, rand int) string {
|
||
|
if rand == 0 {
|
||
|
if plus > minus {
|
||
|
return "+"
|
||
|
}
|
||
|
if plus < minus {
|
||
|
return "-"
|
||
|
}
|
||
|
if plus == minus {
|
||
|
return "0"
|
||
|
}
|
||
|
}
|
||
|
if plus > minus+rand {
|
||
|
return "+"
|
||
|
}
|
||
|
if plus+rand < minus {
|
||
|
return "-"
|
||
|
}
|
||
|
if plus+rand >= minus && plus-rand <= minus {
|
||
|
return "?"
|
||
|
}
|
||
|
if minus+rand >= plus && minus-rand <= plus {
|
||
|
return "?"
|
||
|
}
|
||
|
return "?"
|
||
|
}
|
||
|
|
||
|
func main() {
|
||
|
type node struct {
|
||
|
plus int
|
||
|
minus int
|
||
|
rand int
|
||
|
}
|
||
|
table := []node{
|
||
|
{50, 43, 20},
|
||
|
{13, 13, 0},
|
||
|
{10, 9, 0},
|
||
|
{5, 9, 2},
|
||
|
}
|
||
|
|
||
|
for i := 0; i < 15; i++ {
|
||
|
table = append(table, node{
|
||
|
plus: lib.RandIntBetween(0, 10),
|
||
|
minus: lib.RandIntBetween(0, 10),
|
||
|
rand: lib.RandIntBetween(0, 10),
|
||
|
})
|
||
|
}
|
||
|
for _, arg := range table {
|
||
|
lib.Challenge("Nauuo", student.Nauuo, nauuo, arg.plus, arg.minus, arg.rand)
|
||
|
}
|
||
|
}
|