Skip to content

Commit 7840f16

Browse files
committedNov 8, 2022
chore: Add sample problem from competition archive
1 parent 72b5b18 commit 7840f16

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed
 

‎swift/sample_problem.swift

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import Foundation
2+
3+
let T = Int(readLine()!)!
4+
5+
for ti in 1 ... T {
6+
let line = readLine()!.components(separatedBy: " ")
7+
8+
let N = Int(line[0])!
9+
10+
let M = Int(line[1])!
11+
12+
let C = readLine()!.components(separatedBy: " ").map { Int($0)! }
13+
14+
var sum = 0
15+
16+
for Ci in C {
17+
sum += Ci
18+
}
19+
20+
let modulo = sum % M
21+
22+
print("Case #\(ti): \(modulo)")
23+
}

‎tests/sample_problem.in

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2
2+
7 3
3+
1 2 3 4 5 6 7
4+
5 10
5+
7 7 7 7 7

0 commit comments

Comments
 (0)
Please sign in to comment.