結果
問題 |
No.365 ジェンガソート
|
ユーザー |
![]() |
提出日時 | 2016-04-29 23:17:16 |
言語 | C90 (gcc 12.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 467 bytes |
コンパイル時間 | 859 ms |
コンパイル使用メモリ | 20,352 KB |
実行使用メモリ | 13,636 KB |
最終ジャッジ日時 | 2024-10-04 18:53:52 |
合計ジャッジ時間 | 4,261 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 TLE * 1 -- * 37 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:6:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | scanf("%d\n",&i); | ^~~~~~~~~~~~~~~~ main.c:8:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 8 | scanf(" %d",&a[b]); | ^~~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h> int main() { int b,i,cnt=0,s=0,t,q,k,c,j=0; int a[100001]; scanf("%d\n",&i); for(b=1;b<=i;b++){ scanf(" %d",&a[b]); } while(j==0){ for(c=1;c<i;c++){ if(a[c]>a[c+1]){ break; } if(c==i-1)j=-1; } if(j!=-1){ for(b=2;b<=i;b++){ if(a[b]<a[1]&&a[b]>s){ s=a[b]; t=b; } } for(b=t;b>1;b--){ a[t]=a[t-1]; } a[1]=s; s=0; } if(j==-1)break; cnt++; } printf("%d\n",cnt); return 0; }