Submission #1677708
Source Code Expand
package main import ( "bufio" "fmt" "os" "strconv" ) func main() { sc.Split(bufio.ScanWords) k := nextInt() t := nextInt() cake := make([]int, t) maxCake := 0 for i := 0; i < t; i++ { cake[i] = nextInt() maxCake = max(maxCake, cake[i]) } fmt.Println(max(maxCake-1-(k-maxCake), 0)) } var sc = bufio.NewScanner(os.Stdin) func nextLine() string { sc.Scan() return sc.Text() } func nextInt() int { i, _ := strconv.Atoi(nextLine()) return i } func max(a, b int) int { if a > b { return a } return b }
Submission Info
Submission Time | |
---|---|
Task | B - K Cakes |
User | fmhr |
Language | Go (1.6) |
Score | 200 |
Code Size | 569 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 640 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_000.txt, 0_001.txt, 0_002.txt |
All | 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_000.txt | AC | 1 ms | 640 KB |
0_001.txt | AC | 1 ms | 640 KB |
0_002.txt | AC | 1 ms | 640 KB |
1_003.txt | AC | 1 ms | 640 KB |
1_004.txt | AC | 1 ms | 640 KB |
1_005.txt | AC | 1 ms | 640 KB |
1_006.txt | AC | 1 ms | 640 KB |
1_007.txt | AC | 1 ms | 640 KB |
1_008.txt | AC | 1 ms | 640 KB |
1_009.txt | AC | 1 ms | 640 KB |