File tree Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Original file line number Diff line number Diff line change
1
+ package main
2
+
3
+ import (
4
+ . "fmt"
5
+ "io"
6
+ )
7
+
8
+ // github.com/EndlessCheng/codeforces-go
9
+ func CF25A (in io.Reader , out io.Writer ) {
10
+ var n , c , tar int
11
+ Fscan (in , & n )
12
+ a := make ([]int , n )
13
+ for i := range a {
14
+ Fscan (in , & a [i ])
15
+ a [i ] &= 1
16
+ }
17
+ for _ , v := range a [:3 ] {
18
+ c += v
19
+ }
20
+ if c < 2 {
21
+ tar = 1
22
+ }
23
+ for i , v := range a {
24
+ if v == tar {
25
+ Fprint (out , i + 1 )
26
+ }
27
+ }
28
+ }
29
+
30
+ //func main() { CF25A(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/25/A
9
+ // https://codeforces.com/problemset/status/25/problem/A
10
+ func TestCF25A (t * testing.T ) {
11
+ // just copy from website
12
+ rawText := `
13
+ inputCopy
14
+ 5
15
+ 2 4 7 8 10
16
+ outputCopy
17
+ 3
18
+ inputCopy
19
+ 4
20
+ 1 2 1 1
21
+ outputCopy
22
+ 2`
23
+ testutil .AssertEqualCase (t , rawText , 0 , CF25A )
24
+ }
You can’t perform that action at this time.
0 commit comments