20240512

孤独の価値 - 森博嗣

Read “孤独の価値” by Hiroshi Mori.

The author points out that solitary (?) is too criticized by all kinds of media; human relationships are advertised as more important than reality, making people feel guilty about spending time alone.

I, too, have felt the pressure to cooperate with others in society, but as I look back on my life, I might be happier reducing social relationships.

I don't mean I avoid social events. I'm good at talking with strangers, especially when I use Japanese. Many seniors say that oe of my strenghts might be the communication skills. I cannot say that I blong to the top tier when it comes to technical skills, but I might be able to leverage my communication skills to differentiate from other engineers.

I'm still not confident using English and feel nervous about that tho.


Codeforces Round 944 (Div. 4)

1971A. My First Sorting Problem

simple implementation problem with min() and max()

package main

import (
    "fmt"
)

func main() {
    var t int
    fmt.Scan(&t)
    for i := 0; i < t; i++ {
        var x, y int
        fmt.Scan(&x, &y)
        fmt.Println(min(x, y), max(x, y))
    }

}

1971B. Different String

if the input string consists of only one letter, it's impossible to rearrange the string to form a new string. otherwise (if the input string consists of more than one letter), a new string can be created by rotating the input string.

Not sure I can solve this problem next tiem I encounter tho

from collections import defaultdict


for _ in range(int(input())):
    s = input()
    d = defaultdict(int)
    for c in s:
        d[c] += 1

    if len(d.keys()) == 1:
        print("NO")
    else:
        print("YES")
        print(s[1:] + s[0])

1971C. Clock and Strings

TODO: Check the editorial tmr

problem to think of MECE conditions

package main

import (
    "fmt"
)

func intersect(a int, b int, c int, d int) bool {
    a, b = min(a, b), max(a, b)
    c, d = min(c, d), max(c, d)
    return (c > a && c < b && d > b && d < a+12) || (c < a && d > a && d < b)
}

func main() {
    var t int
    fmt.Scan(&t)
    for i := 0; i < t; i++ {
        var a, b, c, d int
        fmt.Scan(&a, &b, &c, &d)
        if intersect(a, b, c, d) {
            fmt.Println("YES")
        } else {
            fmt.Println("NO")
        }
    }
}

1971D. Binary Cut

To sort the input binary string by spliting and rearranging, the splitted parts should belong to one of these

So that the sorted string can be formed by

000…0000 + 01 + 111…1111

To create parts 00…000 and 11..111, we can focus on “01” and “10”, where the string should be cut to create a string with only 0s and a string with only 1s. Note that 00….01…111 can be allowed one time.

for _ in range(int(input())):
    s = input()
    counter = 1
    used_01 = False
    for i in range(len(s) - 1):
        if s[i : i + 2] == "10":
            counter += 1
        elif s[i : i + 2] == "01":
            if not used_01:
                used_01 = True
            else:
                counter += 1
    print(counter)

Sushi 800 Salad 500 Chicken 400

Total 1700 kcal


TODO:


index 20240511 20240513