結果

問題 No.123 カードシャッフル
ユーザー TLwiegehtt
提出日時 2015-07-07 09:04:20
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 13 ms / 5,000 ms
コード長 300 bytes
コンパイル時間 173 ms
コンパイル使用メモリ 20,736 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-08 01:29:18
合計ジャッジ時間 1,125 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 10
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:7:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |         scanf("%d %d", &n, &m);
      |         ^~~~~~~~~~~~~~~~~~~~~~
main.c:11:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |                 scanf("%d", &arr);
      |                 ^~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(void){
	int i,j;
	int m,n;
	int a[60];
	scanf("%d %d", &n, &m);
	for(i=0;i<(n+5);i++){	a[i] = i;}
	for(i=0;i<m;i++){
		int arr;
		scanf("%d", &arr);
		for(j=arr;j>1;j--){
			int temp = a[j];
			a[j] = a[j-1];
			a[j-1] = temp;
		}
	}
	
	printf("%d\n", a[1]);
	return 0;
}
0