結果

問題 No.365 ジェンガソート
ユーザー ebicochineal
提出日時 2016-05-10 20:40:52
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,041 bytes
コンパイル時間 778 ms
コンパイル使用メモリ 113,828 KB
実行使用メモリ 35,500 KB
最終ジャッジ日時 2024-10-05 13:30:50
合計ジャッジ時間 3,827 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16 WA * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 = 0;
		int ans = 0;
		for(int i=n; i>0; --i){
			if(m[i-1] == n){
				ans += c;
				c = 0;
				--n;
			}else{
				++c;
			}
		}
		Print(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