Submission #1865838
Source Code Expand
#include <stdio.h> #include <stdlib.h> int main() { int n=0; int k=0; int a,b=0; int ans=0; int i,j=0; scanf("%d",&n); scanf("%d",&k); int x[100]; for(j=0;j<n;j++){ scanf("%d",&x[j]); } for(i=0;i<n;i++){ a=x[i]; b=(k-x[i]); if(a>b)ans+=b; else if(a<b)ans+=a; } printf("%d\n",ans*2); return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Collecting Balls (Easy Version) |
User | kazu_1122 |
Language | C (GCC 5.4.1) |
Score | 0 |
Code Size | 419 Byte |
Status | WA |
Exec Time | 1 ms |
Memory | 128 KB |
Compile Error
./Main.c: In function ‘main’: ./Main.c:11:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&n); ^ ./Main.c:12:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&k); ^ ./Main.c:15:9: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&x[j]); ^
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 200 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | subtask0_0.txt, subtask0_1.txt, subtask0_2.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, subtask0_0.txt, subtask0_1.txt, subtask0_2.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | AC | 1 ms | 128 KB |
02.txt | WA | 1 ms | 128 KB |
03.txt | AC | 1 ms | 128 KB |
04.txt | WA | 1 ms | 128 KB |
05.txt | AC | 1 ms | 128 KB |
06.txt | AC | 1 ms | 128 KB |
07.txt | WA | 1 ms | 128 KB |
subtask0_0.txt | AC | 1 ms | 128 KB |
subtask0_1.txt | AC | 1 ms | 128 KB |
subtask0_2.txt | AC | 1 ms | 128 KB |