feat(go): add 791A & 600B

This commit is contained in:
2025-11-18 23:46:16 +07:00
parent 20542601dd
commit 9befed87ce
2 changed files with 53 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
package main
import (
"bufio"
"fmt"
"os"
"sort"
)
func main() {
in := bufio.NewReader(os.Stdin)
var n, m int
fmt.Fscan(in, &n, &m)
a := make([]int, n)
for i := range a {
fmt.Fscan(in, &a[i])
}
sort.Ints(a)
out := bufio.NewWriter(os.Stdout)
for i := 0; i < m; i++ {
var x int
fmt.Fscan(in, &x)
pos := sort.SearchInts(a, x+1)
fmt.Fprint(out, pos)
if i+1 < m {
fmt.Fprint(out, " ")
}
}
out.Flush()
}
+19
View File
@@ -0,0 +1,19 @@
package main
import (
"fmt"
)
func main() {
var a, b int
fmt.Scan(&a, &b)
years := 0
for a <= b {
a *= 3
b *= 2
years++
}
fmt.Println(years)
}