Skip to content

Commit f022211

Browse files
committed
CF268C
1 parent 9926cbf commit f022211

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

main/200-299/268C.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package main
2+
3+
import (
4+
"bufio"
5+
. "fmt"
6+
"io"
7+
)
8+
9+
// github.com/EndlessCheng/codeforces-go
10+
func CF268C(_r io.Reader, _w io.Writer) {
11+
in := bufio.NewReader(_r)
12+
out := bufio.NewWriter(_w)
13+
defer out.Flush()
14+
min := func(a, b int) int {
15+
if a > b {
16+
return b
17+
}
18+
return a
19+
}
20+
21+
var n, m int
22+
Fscan(in, &n, &m)
23+
Fprintln(out, min(n, m)+1)
24+
for x, y := 0, m; x <= n && y >= 0; x, y = x+1, y-1 {
25+
Fprintln(out, x, y)
26+
}
27+
}
28+
29+
//func main() { CF268C(os.Stdin, os.Stdout) }

main/200-299/268C_test.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package main
2+
3+
import (
4+
"github.com/EndlessCheng/codeforces-go/main/testutil"
5+
"testing"
6+
)
7+
8+
// https://codeforces.com/problemset/problem/268/C
9+
// https://codeforces.com/problemset/status/268/problem/C
10+
func TestCF268C(t *testing.T) {
11+
// just copy from website
12+
rawText := `
13+
inputCopy
14+
2 2
15+
outputCopy
16+
3
17+
0 1
18+
1 2
19+
2 0
20+
inputCopy
21+
4 3
22+
outputCopy
23+
4
24+
0 3
25+
2 1
26+
3 0
27+
4 2`
28+
testutil.AssertEqualCase(t, rawText, 0, CF268C)
29+
}

0 commit comments

Comments
 (0)