File tree Expand file tree Collapse file tree 2 files changed +71
-0
lines changed Expand file tree Collapse file tree 2 files changed +71
-0
lines changed Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import (
4
+ "bufio"
5
+ . "fmt"
6
+ "io"
7
+ )
8
+
9
+ // github.com/EndlessCheng/codeforces-go
10
+ func CF1382B (_r io.Reader , _w io.Writer ) {
11
+ in := bufio .NewReader (_r )
12
+ out := bufio .NewWriter (_w )
13
+ defer out .Flush ()
14
+
15
+ var T , n int
16
+ for Fscan (in , & T ); T > 0 ; T -- {
17
+ Fscan (in , & n )
18
+ a := make ([]int , n )
19
+ for i := range a {
20
+ Fscan (in , & a [i ])
21
+ }
22
+ i := 0
23
+ for ; i < n - 1 && a [i ] == 1 ; i ++ {
24
+ }
25
+ if i & 1 == 0 {
26
+ Fprintln (out , "First" )
27
+ } else {
28
+ Fprintln (out , "Second" )
29
+ }
30
+ }
31
+ }
32
+
33
+ //func main() { CF1382B(os.Stdin, os.Stdout) }
Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import (
4
+ "github.com/EndlessCheng/codeforces-go/main/testutil"
5
+ "testing"
6
+ )
7
+
8
+ // https://codeforces.com/problemset/problem/1382/B
9
+ // https://codeforces.com/problemset/status/1382/problem/B
10
+ func TestCF1382B (t * testing.T ) {
11
+ // just copy from website
12
+ rawText := `
13
+ inputCopy
14
+ 7
15
+ 3
16
+ 2 5 4
17
+ 8
18
+ 1 1 1 1 1 1 1 1
19
+ 6
20
+ 1 2 3 4 5 6
21
+ 6
22
+ 1 1 2 1 2 2
23
+ 1
24
+ 1000000000
25
+ 5
26
+ 1 2 2 1 1
27
+ 3
28
+ 1 1 1
29
+ outputCopy
30
+ First
31
+ Second
32
+ Second
33
+ First
34
+ First
35
+ Second
36
+ First`
37
+ testutil .AssertEqualCase (t , rawText , 0 , CF1382B )
38
+ }
You can’t perform that action at this time.
0 commit comments