結果
| 問題 | No.39 桁の数字を入れ替え |
| コンテスト | |
| ユーザー |
mban
|
| 提出日時 | 2016-12-22 14:50:34 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 25 ms / 5,000 ms |
| コード長 | 760 bytes |
| 記録 | |
| コンパイル時間 | 1,837 ms |
| コンパイル使用メモリ | 104,448 KB |
| 実行使用メモリ | 18,560 KB |
| 最終ジャッジ日時 | 2024-10-02 07:15:40 |
| 合計ジャッジ時間 | 3,060 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 19 |
コンパイルメッセージ
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;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
class Magatro
{
static void Main()
{
string N = Console.ReadLine();
long max = long.Parse(N);
for (int i = 1; i < N.Length; i++)
{
for (int j = 0; j < i; j++)
{
char[] c = N.ToArray();
swap(ref c[i], ref c[j]);
long q = long.Parse(new string(c));
max = Math.Max(max, q);
}
}
Console.WriteLine(max);
}
static void swap(ref char a, ref char b)
{
char t = a;
a = b;
b = t;
}
}
mban