結果
| 問題 |
No.397 NO MORE KADOMATSU
|
| コンテスト | |
| ユーザー |
mban
|
| 提出日時 | 2016-11-10 15:57:41 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 110 ms / 2,000 ms |
| コード長 | 836 bytes |
| コンパイル時間 | 2,072 ms |
| コンパイル使用メモリ | 109,988 KB |
| 実行使用メモリ | 44,148 KB |
| 平均クエリ数 | 936.56 |
| 最終ジャッジ日時 | 2024-07-17 00:36:34 |
| 合計ジャッジ時間 | 3,518 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 18 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Collections.Generic;
using System.Linq;
class Magatro
{
static void Main()
{
List<string> L = new List<string>();
int N = int.Parse(Console.ReadLine());
int[] a = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
for(int i = N; i >=1; i--)
{
for(int j = 0; j < i-1; j++)
{
if (a[j] > a[j + 1])
{
int q = a[j];
a[j] = a[j+1] ;
a[j + 1] = q;
L.Add(string.Format("{0} {1}", j, j + 1));
}
}
}
Console.WriteLine(L.Count);
for(int i = 0; i < L.Count; i++)
{
Console.WriteLine(L[i]);
}
Console.WriteLine();
}
}
mban