結果
問題 |
No.123 カードシャッフル
|
ユーザー |
|
提出日時 | 2017-03-06 16:27:53 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 11 ms / 5,000 ms |
コード長 | 341 bytes |
コンパイル時間 | 107 ms |
コンパイル使用メモリ | 21,120 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-23 11:24:59 |
合計ジャッジ時間 | 730 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 10 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:8:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 8 | scanf("%d %d",&N,&M); | ^~~~~~~~~~~~~~~~~~~~ main.c:17:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 17 | scanf("%d",&a); | ^~~~~~~~~~~~~~
ソースコード
#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; }