Submission #3816362
Source Code Expand
#include <stdio.h> int main(void){ int n,c[100],i,j,o,a=0,b=0; scanf("%d",&n); for (i=0;i<n;i++){ scanf("%d",&c[i]); } for (i=1;i<n;i++){ for (j=0;j<i;j++){ if (c[i]>c[j]){ o=c[i]; c[i]=c[j]; c[j]=o; } } } i=0; while (1){ a+=c[i]; i++; if (i==n) break; b+=c[i]; i++; if (i==n) break; } printf("%d",a-b); return 0; }
Submission Info
Submission Time | |
---|---|
Task | ABC088B - Card Game for Two |
User | Jupytor |
Language | C++14 (GCC 5.4.1) |
Score | 200 |
Code Size | 436 Byte |
Status | AC |
Exec Time | 2 ms |
Memory | 128 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:4:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&n); ^ ./Main.cpp:6:22: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&c[i]); ^
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_1.txt, sample_2.txt, sample_3.txt |
All | in1.txt, in2.txt, in3.txt, in4.txt, in5.txt, in6.txt, in7.txt, in8.txt, in9.txt, sample_1.txt, sample_2.txt, sample_3.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
in1.txt | AC | 1 ms | 128 KB |
in2.txt | AC | 1 ms | 128 KB |
in3.txt | AC | 1 ms | 128 KB |
in4.txt | AC | 2 ms | 128 KB |
in5.txt | AC | 1 ms | 128 KB |
in6.txt | AC | 1 ms | 128 KB |
in7.txt | AC | 1 ms | 128 KB |
in8.txt | AC | 1 ms | 128 KB |
in9.txt | AC | 1 ms | 128 KB |
sample_1.txt | AC | 1 ms | 128 KB |
sample_2.txt | AC | 1 ms | 128 KB |
sample_3.txt | AC | 1 ms | 128 KB |