結果
| 問題 |
No.397 NO MORE KADOMATSU
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-07-16 00:11:50 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 65 ms / 2,000 ms |
| コード長 | 1,310 bytes |
| コンパイル時間 | 980 ms |
| コンパイル使用メモリ | 113,804 KB |
| 実行使用メモリ | 35,232 KB |
| 平均クエリ数 | 936.56 |
| 最終ジャッジ日時 | 2024-07-17 00:09:17 |
| 合計ジャッジ時間 | 3,301 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
using System.Text;
using System.Threading.Tasks;
namespace yuki0715_D
{
class Program
{
static void Main(string[] args)
{
var sb = new StringBuilder();
int n = getint();
var x = getsplit();
var a = Array.ConvertAll(x, int.Parse);
bool s = true;
int count = 0;
while (s)
{
s = false;
for (int j = n - 1; j > 0; j--)
{
if (a[j] < a[j - 1])
{
int k = a[j - 1];
a[j - 1] = a[j];
a[j] = k;
sb.AppendLine(j-1 + " "+j);
count++;
s = true;
}
}
}
Console.WriteLine(count);
Console.Write(sb);
n = getint();
}
public static string[] getsplit()
{
string[] x = Console.ReadLine().Split(' ');
return x;
}
public static int getint()
{
int x = int.Parse(Console.ReadLine());
return x;
}
}
}