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.
43 lines
698 B
43 lines
698 B
5 years ago
|
package main
|
||
|
|
||
5 years ago
|
import (
|
||
5 years ago
|
student "student"
|
||
|
|
||
|
"lib"
|
||
5 years ago
|
)
|
||
5 years ago
|
|
||
|
func halfContest(h1, m1, h2, m2 int) int {
|
||
|
t1 := h1*60 + m1
|
||
|
t2 := h2*60 + m2
|
||
|
t2 = (t2 + t1) / 2
|
||
|
h2 = t2 / 60
|
||
|
m2 = t2 % 60
|
||
|
return h2*100 + m2
|
||
|
}
|
||
5 years ago
|
|
||
5 years ago
|
func main() {
|
||
5 years ago
|
type node struct {
|
||
5 years ago
|
h1, m1 int
|
||
|
h2, m2 int
|
||
|
}
|
||
|
table := []node{
|
||
|
{11, 44, 21, 59},
|
||
|
{1, 12, 1, 14},
|
||
|
{5, 50, 6, 51},
|
||
|
{14, 35, 18, 55},
|
||
5 years ago
|
}
|
||
|
|
||
|
for i := 0; i < 20; i++ {
|
||
5 years ago
|
table = append(table, node{
|
||
5 years ago
|
h1: lib.RandIntBetween(0, 10),
|
||
|
m1: lib.RandIntBetween(0, 59),
|
||
|
h2: lib.RandIntBetween(11, 23),
|
||
|
m2: lib.RandIntBetween(0, 59),
|
||
5 years ago
|
})
|
||
5 years ago
|
}
|
||
|
|
||
|
for _, arg := range table {
|
||
5 years ago
|
lib.Challenge("HalfContest", student.HalfContest, halfContest, arg.h1, arg.m1, arg.h2, arg.m2)
|
||
5 years ago
|
}
|
||
|
}
|