結果

問題 No.77 レンガのピラミッド
ユーザー Mcpu3Mcpu3
提出日時 2018-09-13 00:09:19
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 454 bytes
コンパイル時間 209 ms
コンパイル使用メモリ 30,668 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-10 11:38:12
合計ジャッジ時間 1,729 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 0 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 WA -
testcase_07 AC 1 ms
4,380 KB
testcase_08 WA -
testcase_09 AC 0 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 0 ms
4,376 KB
testcase_18 WA -
testcase_19 AC 0 ms
4,376 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 1 ms
4,380 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(void)
{
    int N,A[100]={0},t[199]={0},s=0,a=0,i,j;
    scanf("%d",&N);
    for(i=0;i<N;++i){
        scanf("%d",&A[i]);
        s+=A[i];
    }
    for(i=1;(int)pow((i+1)/2,2)<=s;i+=2);
    for(j=0;j<(i-1)/2;++j)t[j]=j+1;
    for(j=(i-1)/2;j<i-2;++j)t[j]=i-2-j;
    for(j=0;j<i-2;++j)if(t[j]>A[j])a+=t[j]-A[j];
    printf("%d",a+s-(int)pow((i-1)/2,2));
    return 0;
}
0