結果

問題 No.365 ジェンガソート
ユーザー ebicochineal
提出日時 2016-05-10 21:54:33
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 64 ms / 2,000 ms
コード長 1,010 bytes
コンパイル時間 871 ms
コンパイル使用メモリ 109,672 KB
実行使用メモリ 33,140 KB
最終ジャッジ日時 2024-10-12 02:16:25
合計ジャッジ時間 3,808 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 41
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

public class P{
	public static void Main(){
		int n = InputToInt();
		int[] m = Input().Split().MapInt();
		int c = n;
		int ans = 0;
		for(int i=n; i>0; --i){
			if(m[i-1] == c){
				++ans;
				--c;
			}
		}
		Print(n-ans);
	}
	
	public static void Print(params object[] o){
		for(int i=0; i<o.Length; ++i){
			Console.Write(o[i]);
			Console.Write(i==o.Length-1 ? '\n' : ' ');
		}
	}
	public static string Input(){return Console.ReadLine();}
	public static int InputToInt(){return int.Parse(Console.ReadLine());}
}

public static class StringArrayExtensions{
	public static int[] MapInt(this string[] s){return s.Select(int.Parse).ToArray();}
	public static long[] MapLong(this string[] s){return s.Select(long.Parse).ToArray();}
	public static float[] MapFloat(this string[] s){return s.Select(float.Parse).ToArray();}
	public static double[] MapDouble(this string[] s){return s.Select(double.Parse).ToArray();}
}
0