Skip to content

Commit 6b2fb74

Browse files
committed
codeforces: next round
1 parent a7a18f8 commit 6b2fb74

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

codeforces_day01/next_round.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package main
2+
3+
import (
4+
"bufio"
5+
"fmt"
6+
"os"
7+
"strconv"
8+
9+
// "strconv"
10+
"strings"
11+
)
12+
13+
14+
func main() {
15+
scanner:=bufio.NewScanner(os.Stdin)
16+
// scanner.Split(bufio.ScanWords)
17+
scanner.Scan()
18+
t:=strings.Split(scanner.Text(), " ")
19+
scanner.Scan()
20+
21+
data:=strings.Split(scanner.Text(), " ")
22+
count:=0;
23+
k,_:=strconv.Atoi(t[1])
24+
comapre,_:=strconv.Atoi(data[k-1])
25+
if(k>=1&&k<=len(data)){
26+
for i:=0;i<len(data);i++{
27+
operand,_:=strconv.Atoi(data[i])
28+
if(operand>=comapre && operand!=0){
29+
count++
30+
}
31+
}
32+
}
33+
fmt.Println(count)
34+
}

0 commit comments

Comments
 (0)