Submission #5907027
Source Code Expand
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNextInt()) { int n = sc.nextInt(); int k = sc.nextInt(); int[] a = new int[n]; int idx1 = -1; for (int i = 0; i < n; i++) { a[i] = sc.nextInt(); if ( a[i] == 1 ) { idx1 = i; } } int ans = 0; for (int i = 0; i < n; i++) { ans++; for (int j = 0; j < k; j++) i++; i--; if ( i >= n - 1 ) { break; } else { i--; } } System.out.println(ans); } } }
Submission Info
Submission Time | |
---|---|
Task | C - Minimization |
User | itohjam |
Language | Java8 (OpenJDK 1.8.0) |
Score | 300 |
Code Size | 894 Byte |
Status | AC |
Exec Time | 441 ms |
Memory | 50552 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample1.txt, sample2.txt, sample3.txt |
All | sample1.txt, sample2.txt, sample3.txt, 1.txt, 10.txt, 2.txt, 3.txt, 4.txt, 5.txt, 6.txt, 7.txt, 8.txt, 9.txt, sample1.txt, sample2.txt, sample3.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
1.txt | AC | 316 ms | 45640 KB |
10.txt | AC | 408 ms | 47312 KB |
2.txt | AC | 410 ms | 50552 KB |
3.txt | AC | 343 ms | 44316 KB |
4.txt | AC | 406 ms | 48644 KB |
5.txt | AC | 441 ms | 49756 KB |
6.txt | AC | 418 ms | 45420 KB |
7.txt | AC | 184 ms | 27900 KB |
8.txt | AC | 410 ms | 47664 KB |
9.txt | AC | 128 ms | 22356 KB |
sample1.txt | AC | 93 ms | 21716 KB |
sample2.txt | AC | 92 ms | 18644 KB |
sample3.txt | AC | 93 ms | 21204 KB |