結果
問題 |
No.365 ジェンガソート
|
ユーザー |
|
提出日時 | 2017-03-21 23:11:26 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 889 bytes |
コンパイル時間 | 910 ms |
コンパイル使用メモリ | 103,040 KB |
実行使用メモリ | 40,576 KB |
最終ジャッジ日時 | 2024-07-05 06:11:05 |
合計ジャッジ時間 | 5,439 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 8 WA * 8 TLE * 1 -- * 24 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; namespace yukicoder { class _090 { static void Main() { int[] num = new int[int.Parse(Console.ReadLine())]; string[] s = Console.ReadLine().Split(' '); int min = 0; for(int i = 0;i < num.Length; i++) { num[i] = int.Parse(s[i]); } for(int i = num.Length - 1; i >= 0; i--) { while(num[i] != i + 1) { chr(num, i); min++; } } Console.WriteLine(min); } static void chr(int[] num,int k) { int t = num[k]; for(int i = k; i > 0; i--) { num[i] = num[i - 1]; } num[0] = t; } } }