Skip to content

Commit de409b5

Browse files
PDF 版と解答がいくつか異なっていたため修正しました。
問題1 PDF 版の解答が載っておらず、別解が 1 つずつずれていました。 問題7 別解が異なっていました。 問題18 PDF 版では x[$g]=${x[$g]}. が x[$g]+=. になっていました。 問題25 別解が解答と同じになっていました。
1 parent 7240fed commit de409b5

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

answer/1.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
### 解答
22
```
3-
$ cat files.txt | grep '\.exe$'
3+
$ grep '\.exe$' files.txt
44
```
55
### 別解
66
```
7-
別解1(山田)$ cat files.txt | sed -n '/\.exe$/p'
8-
別解2(山田)$ cat files.txt | awk '/\.exe$/'
9-
別解3(山田)$ cat files.txt | perl -ne '/\.exe$/ and print'
7+
別解1(山田)$ cat files.txt | grep '\.exe$'
8+
別解2(山田)$ cat files.txt | sed -n '/\.exe$/p'
9+
別解3(山田)$ cat files.txt | awk '/\.exe$/'
10+
別解4(山田)$ cat files.txt | perl -ne '/\.exe$/ and print'
1011
```

answer/18.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
### 解答
22
```
3-
$ declare -A x ; IFS=: ; while read {a..g} ; do x[$g]=${x[$g]}. ; done < /etc/passwd ; for s in ${!x[@]} ; do echo $s ${#x[$s]}; done ; unset x
3+
$ declare -A x ; IFS=: ; while read {a..g} ; do x[$g]+=. ; done < /etc/passwd ; for s in ${!x[@]} ; do echo $s ${#x[$s]}; done ; unset x
44
```
55
### 別解
66
```
7-
別解1(上田)$ declare -A x ; IFS=: ; while read {a..g} ; do [[ "$g" = "" ]] || x[$g]=${x[$g]}. ; done </etc/passwd ; for s in ${!x[@]} ; do echo $s ${#x[$s]} ; done ; unset x
7+
別解1(上田)$ declare -A x ; IFS=: ; while read {a..g} ; do [[ "$g" = "" ]] || x[$g]+=. ; done </etc/passwd ; for s in ${!x[@]} ; do echo $s ${#x[$s]} ; done ; unset x
88
```
99
#### 別解2(今泉)
1010
```

answer/25.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ $ sort | head > .tmp.top10 || true
44
```
55
### 別解
66
```
7-
sort | head > .tmp.top10 || true
7+
別解(田代)$ sort | sed -n '1,10p' > .tmp.top10
88
```

answer/7.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ $ cat kakeibo.txt | awk '{tax=($1<"20191001"||$2~"^*") ? 1.08 : 1.1; print $0,ta
44
```
55
### 別解
66
```
7-
別解(上田)$ cat kakeibo.txt | awk '{print $3, ($1<"20191001"||$2~"^*") ? 1.08 : 1.1}' | awk '{a+=int($1*$2)}END{print a}'
7+
別解(上田)$ cat kakeibo.txt | awk '{tax=1.1}$1<"20191001"{tax=1.08}/ \*/{tax=1.08}{print $3*tax}' | sed 's/\..*//' | awk '{a+=$1}END{print a}'
88
```

0 commit comments

Comments
 (0)