結果
| 問題 |
No.559 swapAB列
|
| コンテスト | |
| ユーザー |
No
|
| 提出日時 | 2017-08-26 00:39:39 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 23 ms / 2,000 ms |
| コード長 | 642 bytes |
| コンパイル時間 | 968 ms |
| コンパイル使用メモリ | 108,904 KB |
| 実行使用メモリ | 17,664 KB |
| 最終ジャッジ日時 | 2024-10-15 16:21:14 |
| 合計ジャッジ時間 | 1,662 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
namespace y
{
class Program
{
static void Main(string[] args)
{
char[] c = Console.ReadLine().ToCharArray();
int cnt = 0;
for (int i = 0; i < c.Length - 1; i++)
{
for (int j = c.Length - 1; j > i; j--)
{
if (c[j] < c[j -1])
{
char w = c[j];
c[j] = c[j -1];
c[j - 1] = w;
cnt++;
}
}
}
Console.WriteLine(cnt);
}
}
}
No