結果
問題 | No.123 カードシャッフル |
ユーザー |
![]() |
提出日時 | 2015-12-28 22:59:29 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 11 ms / 5,000 ms |
コード長 | 286 bytes |
コンパイル時間 | 203 ms |
コンパイル使用メモリ | 34,252 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-19 08:00:14 |
合計ジャッジ時間 | 1,002 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 10 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:6:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | int a,b;scanf("%d%d",&a,&b); | ~~~~~^~~~~~~~~~~~~~ main.cpp:11:28: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | int d;scanf("%d",&d);d--; | ~~~~~^~~~~~~~~
ソースコード
#include<stdio.h>#include<algorithm>using namespace std;int c[60];int main(){int a,b;scanf("%d%d",&a,&b);for(int i=0;i<a;i++){c[i]=i+1;}for(int i=0;i<b;i++){int d;scanf("%d",&d);d--;int e=c[d];for(int j=d;j>0;j--)c[j]=c[j-1];c[0]=e;}printf("%d\n",c[0]);}