結果
| 問題 | No.123 カードシャッフル | 
| コンテスト | |
| ユーザー |  funakoshi | 
| 提出日時 | 2019-08-23 16:54:22 | 
| 言語 | C (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 10 ms / 5,000 ms | 
| コード長 | 489 bytes | 
| コンパイル時間 | 305 ms | 
| コンパイル使用メモリ | 31,360 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2024-10-13 14:30:23 | 
| 合計ジャッジ時間 | 935 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 10 | 
ソースコード
#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);
}
            
            
            
        