結果

問題 No.123 カードシャッフル
ユーザー a2011404a2011404
提出日時 2017-03-06 16:27:53
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 11 ms / 5,000 ms
コード長 341 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 24,580 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-05 15:53:09
合計ジャッジ時間 873 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<stdio.h>


int main(void){

int N,M,A[51]={},a,i,j,temp=0;

	scanf("%d %d",&N,&M);

for(i=1;i<=N;i++){
	A[i]=i;
}



for(j=1;j<=M;j++){
	scanf("%d",&a);
	temp=A[a];

	for(i=a;i>1;i--){
		A[i]=A[i-1];
	}
	A[1]=temp;
			//for(i=1;i<=N;i++){途中経過
			//printf("A[%d]=%d\n",i,A[i]);
			//}
}

printf("%d\n",A[1]);

return 0;



}
0