提出 #1218814
ソースコード 拡げる
#include<stdio.h>
int main(void){
int N,L[200];
int i,j;
int a;
int sum;
sum=0;
scanf("%d",&N);
for(i=0;i<N*2;i++){
scanf("%d",&L[i]);
}
for(i=0;i<=N*2-1;i++){
for(j=i;j<=N*2-1;j++){
if(L[j]<L[i]){
a=L[i];
L[i]=L[j];
L[j]=a;
}
}
}
for(i=0;i<=N*2-1;i=i+2){
sum=sum+L[i];
}
printf("%d\n",sum);
return 0;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | A - BBQ Easy |
| ユーザ | aizu_d |
| 言語 | C++14 (GCC 5.4.1) |
| 得点 | 200 |
| コード長 | 391 Byte |
| 結果 | AC |
| 実行時間 | 1 ms |
| メモリ | 128 KiB |
コンパイルエラー
./Main.cpp: In function ‘int main()’:
./Main.cpp:9:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&N);
^
./Main.cpp:11:22: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d",&L[i]);
^
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 200 / 200 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | sample-01.txt, sample-02.txt |
| All | sample-01.txt, sample-02.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, sample-01.txt, sample-02.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 01-01.txt | AC | 1 ms | 128 KiB |
| 01-02.txt | AC | 1 ms | 128 KiB |
| 01-03.txt | AC | 1 ms | 128 KiB |
| 01-04.txt | AC | 1 ms | 128 KiB |
| 01-05.txt | AC | 1 ms | 128 KiB |
| 01-06.txt | AC | 1 ms | 128 KiB |
| 01-07.txt | AC | 1 ms | 128 KiB |
| 01-08.txt | AC | 1 ms | 128 KiB |
| sample-01.txt | AC | 1 ms | 128 KiB |
| sample-02.txt | AC | 0 ms | 128 KiB |