提出 #501209


ソースコード 拡げる

#include<stdio.h>
int main(void)
{
    int i,n,b,c,ans=0,a[110]={0};
    scanf("%d %d %d",&n,&b,&c);
    for(i=0;i<n;i++)scanf("%d",&a[i]);
    if(b!=0 && c!=0){
        for(i=n-1;i>=0;i--){
            if(c<b){
                ans=ans+a[i]*c;
                break;
            }
            ans=ans+a[i]*b;
            c=c-b;
        }
        printf("%d\n",ans);
    }
    else printf("0\n");
    return 0;
}

提出情報

提出日時
問題 B - ラー油
ユーザ aoringo
言語 C (GCC 4.9.2)
得点 50
コード長 432 Byte
結果 AC
実行時間 26 ms
メモリ 804 KiB

コンパイルエラー

./Main.c: In function ‘main’:
./Main.c:5:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d %d",&n,&b,&c);
     ^
./Main.c:6:21: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
     for(i=0;i<n;i++)scanf("%d",&a[i]);
                     ^

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 50 / 50
結果
AC × 6
AC × 67
セット名 テストケース
Sample 00_example_01.txt, 00_example_02.txt, 00_example_03.txt, 00_example_04.txt, 00_example_05.txt, 00_example_06.txt
All 00_example_01.txt, 00_example_02.txt, 00_example_03.txt, 00_example_04.txt, 00_example_05.txt, 00_example_06.txt, 10_rand_01.txt, 10_rand_02.txt, 10_rand_03.txt, 10_rand_04.txt, 10_rand_05.txt, 20_SB_SC_01.txt, 20_SB_SC_02.txt, 20_SB_SC_03.txt, 20_SB_SC_04.txt, 20_SB_SC_05.txt, 30_SB_LC_01.txt, 30_SB_LC_02.txt, 30_SB_LC_03.txt, 30_SB_LC_04.txt, 30_SB_LC_05.txt, 40_LB_SC_01.txt, 40_LB_SC_02.txt, 40_LB_SC_03.txt, 40_LB_SC_04.txt, 40_LB_SC_05.txt, 50_LB_LC_01.txt, 50_LB_LC_02.txt, 50_LB_LC_03.txt, 50_LB_LC_04.txt, 50_LB_LC_05.txt, 60_max_01.txt, 60_max_02.txt, 60_max_03.txt, 60_max_04.txt, 60_max_05.txt, 70_same_01.txt, 70_same_02.txt, 70_same_03.txt, 70_same_04.txt, 70_same_05.txt, 80_sparse_01.txt, 80_sparse_02.txt, 80_sparse_03.txt, 80_sparse_04.txt, 80_sparse_05.txt, 80_sparse_06.txt, 80_sparse_07.txt, 80_sparse_08.txt, 80_sparse_09.txt, 80_sparse_10.txt, 90_hand_01.txt, 90_hand_02.txt, 90_hand_03.txt, 90_hand_04.txt, 90_hand_05.txt, 95_corner_01.txt, 95_corner_02.txt, 95_corner_03.txt, 95_corner_04.txt, 95_corner_05.txt, 00_example_01.txt, 00_example_02.txt, 00_example_03.txt, 00_example_04.txt, 00_example_05.txt, 00_example_06.txt
ケース名 結果 実行時間 メモリ
00_example_01.txt AC 25 ms 672 KiB
00_example_02.txt AC 22 ms 792 KiB
00_example_03.txt AC 24 ms 788 KiB
00_example_04.txt AC 23 ms 796 KiB
00_example_05.txt AC 23 ms 800 KiB
00_example_06.txt AC 24 ms 704 KiB
10_rand_01.txt AC 24 ms 800 KiB
10_rand_02.txt AC 23 ms 796 KiB
10_rand_03.txt AC 22 ms 704 KiB
10_rand_04.txt AC 22 ms 800 KiB
10_rand_05.txt AC 25 ms 792 KiB
20_SB_SC_01.txt AC 24 ms 796 KiB
20_SB_SC_02.txt AC 24 ms 788 KiB
20_SB_SC_03.txt AC 23 ms 796 KiB
20_SB_SC_04.txt AC 23 ms 796 KiB
20_SB_SC_05.txt AC 22 ms 704 KiB
30_SB_LC_01.txt AC 23 ms 804 KiB
30_SB_LC_02.txt AC 24 ms 800 KiB
30_SB_LC_03.txt AC 23 ms 748 KiB
30_SB_LC_04.txt AC 24 ms 704 KiB
30_SB_LC_05.txt AC 22 ms 792 KiB
40_LB_SC_01.txt AC 23 ms 796 KiB
40_LB_SC_02.txt AC 24 ms 796 KiB
40_LB_SC_03.txt AC 22 ms 796 KiB
40_LB_SC_04.txt AC 23 ms 792 KiB
40_LB_SC_05.txt AC 22 ms 792 KiB
50_LB_LC_01.txt AC 24 ms 700 KiB
50_LB_LC_02.txt AC 22 ms 796 KiB
50_LB_LC_03.txt AC 24 ms 704 KiB
50_LB_LC_04.txt AC 24 ms 700 KiB
50_LB_LC_05.txt AC 26 ms 788 KiB
60_max_01.txt AC 22 ms 708 KiB
60_max_02.txt AC 22 ms 800 KiB
60_max_03.txt AC 23 ms 792 KiB
60_max_04.txt AC 23 ms 800 KiB
60_max_05.txt AC 25 ms 800 KiB
70_same_01.txt AC 22 ms 708 KiB
70_same_02.txt AC 22 ms 704 KiB
70_same_03.txt AC 22 ms 800 KiB
70_same_04.txt AC 23 ms 712 KiB
70_same_05.txt AC 22 ms 796 KiB
80_sparse_01.txt AC 23 ms 796 KiB
80_sparse_02.txt AC 24 ms 644 KiB
80_sparse_03.txt AC 25 ms 708 KiB
80_sparse_04.txt AC 24 ms 756 KiB
80_sparse_05.txt AC 25 ms 792 KiB
80_sparse_06.txt AC 23 ms 700 KiB
80_sparse_07.txt AC 23 ms 644 KiB
80_sparse_08.txt AC 24 ms 644 KiB
80_sparse_09.txt AC 24 ms 796 KiB
80_sparse_10.txt AC 25 ms 796 KiB
90_hand_01.txt AC 24 ms 788 KiB
90_hand_02.txt AC 25 ms 672 KiB
90_hand_03.txt AC 23 ms 696 KiB
90_hand_04.txt AC 23 ms 796 KiB
90_hand_05.txt AC 23 ms 644 KiB
95_corner_01.txt AC 23 ms 784 KiB
95_corner_02.txt AC 25 ms 800 KiB
95_corner_03.txt AC 25 ms 664 KiB
95_corner_04.txt AC 23 ms 800 KiB
95_corner_05.txt AC 25 ms 796 KiB