Submission #2894468
Source Code Expand
#include <stdio.h> #include <stdlib.h> #include <math.h> int main(void){ int N; int K; int a; double i; double j; int min; scanf("%d",&N); scanf("%d",&K); int A[N]; for(a = 0;a<N;a++){ scanf("%d",&A[a]); } for(a = 0;a<N;a++){ if(A[a] == 1){ min = a; } } i = ceil(min/(K-1)); if(min-(K-1)*i > 0){ // i = i + 1; } j = ceil((N-min-1)/(K-1)); if((N-min-1)-(K-1)*j > 0){ // j = j + 1; } printf("%d",i+j); return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Minimization |
User | maron16 |
Language | C (GCC 5.4.1) |
Score | 0 |
Code Size | 463 Byte |
Status | WA |
Exec Time | 11 ms |
Memory | 512 KB |
Compile Error
./Main.c: In function ‘main’: ./Main.c:31:8: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘double’ [-Wformat=] printf("%d",i+j); ^ ./Main.c:12:1: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&N); ^ ./Main.c:13:1: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&K); ^ ./Main.c:16:1: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&A[a]); ^
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 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 | WA | 5 ms | 384 KB |
10.txt | WA | 9 ms | 512 KB |
2.txt | WA | 11 ms | 512 KB |
3.txt | WA | 6 ms | 384 KB |
4.txt | WA | 10 ms | 512 KB |
5.txt | WA | 11 ms | 512 KB |
6.txt | WA | 11 ms | 512 KB |
7.txt | WA | 1 ms | 256 KB |
8.txt | WA | 10 ms | 512 KB |
9.txt | WA | 1 ms | 128 KB |
sample1.txt | WA | 1 ms | 128 KB |
sample2.txt | WA | 1 ms | 128 KB |
sample3.txt | WA | 1 ms | 128 KB |