結果
問題 |
No.123 カードシャッフル
|
ユーザー |
![]() |
提出日時 | 2015-09-04 12:20:33 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 10 ms / 5,000 ms |
コード長 | 424 bytes |
コンパイル時間 | 503 ms |
コンパイル使用メモリ | 20,736 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-18 23:41:02 |
合計ジャッジ時間 | 1,035 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 10 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:5:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 5 | scanf("%d %d", &N, &M); | ^~~~~~~~~~~~~~~~~~~~~~ main.c:11:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | scanf("%d" ,&A); | ^~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> int main(void){ int i, j, M, N, A, temp; scanf("%d %d", &N, &M); int card[N+1]; for(i=1;i<=N;i++){ card[i] = i; } for(i=0;i<M;i++){ scanf("%d" ,&A); if(A!=1){ temp = card[A]; for(j=A;j>1;j--){ card[j] = card[j-1]; } card[1] = temp; } } printf("%d\n", card[1]); return 0; }