結果

問題 No.123 カードシャッフル
ユーザー funakoshifunakoshi
提出日時 2019-08-23 16:54:22
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 11 ms / 5,000 ms
コード長 489 bytes
コンパイル時間 155 ms
コンパイル使用メモリ 32,000 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-21 15:38:06
合計ジャッジ時間 831 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 9 ms
5,376 KB
testcase_11 AC 11 ms
5,376 KB
testcase_12 AC 10 ms
5,376 KB
testcase_13 AC 10 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
int main(void)
{
    int totalcard,shuffle,top=1;
    scanf("%d %d",&totalcard,&shuffle);
    int sf[shuffle];
    for(int i=0;i<shuffle;i++)
    {
        scanf("%d",&sf[i]);
    }
    for(int i=shuffle-1;0<=i;i--)
    {
        if(top==1)
        {
            top=sf[i];
        }
        else if (sf[i]>=top)
        {
            top--;
        }
        
    }
    printf("%d",top);
}
0