結果
問題 |
No.365 ジェンガソート
|
ユーザー |
![]() |
提出日時 | 2020-09-10 20:53:50 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 626 bytes |
コンパイル時間 | 2,515 ms |
コンパイル使用メモリ | 103,680 KB |
実行使用メモリ | 25,344 KB |
最終ジャッジ日時 | 2024-12-24 00:17:49 |
合計ジャッジ時間 | 4,605 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 WA * 31 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; public class Hello { static void Main() { var n = int.Parse(Console.ReadLine().Trim()); string[] line = Console.ReadLine().Trim().Split(' '); var a = Array.ConvertAll(line, int.Parse); getAns(n, a); } static void getAns(int n, int[] a) { var np = 0; for (int i = 0; i < n; i++) { if (a[i] == n) { np = i; break; } } var count = 1; var t = n; for (int i = np - 1; i >= 0; i--) { if (a[i] < t) { count++; t = a[i]; } } Console.WriteLine(n - count); } }