Submission #2384554
Source Code Expand
#include <stdio.h> #include <math.h> int main(){ int n,i,j,k;/*n:要素の個数,i:ループ用変数,j:要素中の最大値の番号,k:sentとの差が最も小さいやつ*/ float sent; scanf("%d",&n); int a[n]; j = 0; for(i=0; i<n; i++){ scanf("%d",&a[i]); if(a[i] > a[j]) j = i; } sent = (a[j]+1)/2.0f -0.5f; if(j == 0) k=1; else k = 0; for(i=0;i<n;i++){ if(a[i] == 0 && k==j) k = i; if(fabs(sent - a[i]) <= fabs(sent - a[k])){ k = i; } } printf("%d %d\n",a[j],a[k]); }
Submission Info
Submission Time | |
---|---|
Task | D - Binomial Coefficients |
User | windbell |
Language | C (GCC 5.4.1) |
Score | 0 |
Code Size | 523 Byte |
Status | WA |
Exec Time | 14 ms |
Memory | 512 KB |
Compile Error
./Main.c: In function ‘main’: ./Main.c:6:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&n); ^ ./Main.c:10:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&a[i]); ^
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 400 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample1.txt, sample2.txt |
All | even0.txt, even1.txt, float.txt, odd0.txt, odd1.txt, rnd_0.txt, rnd_1.txt, rnd_2.txt, rnd_3.txt, rnd_4.txt, rnd_5.txt, rnd_6.txt, rnd_7.txt, rnd_8.txt, rnd_9.txt, sample1.txt, sample2.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
even0.txt | AC | 13 ms | 512 KB |
even1.txt | AC | 13 ms | 512 KB |
float.txt | WA | 14 ms | 512 KB |
odd0.txt | WA | 13 ms | 512 KB |
odd1.txt | WA | 13 ms | 512 KB |
rnd_0.txt | AC | 12 ms | 512 KB |
rnd_1.txt | AC | 11 ms | 512 KB |
rnd_2.txt | AC | 12 ms | 512 KB |
rnd_3.txt | AC | 11 ms | 512 KB |
rnd_4.txt | AC | 10 ms | 384 KB |
rnd_5.txt | AC | 13 ms | 512 KB |
rnd_6.txt | AC | 11 ms | 512 KB |
rnd_7.txt | AC | 10 ms | 512 KB |
rnd_8.txt | AC | 12 ms | 512 KB |
rnd_9.txt | AC | 11 ms | 512 KB |
sample1.txt | AC | 1 ms | 128 KB |
sample2.txt | AC | 1 ms | 128 KB |