結果
| 問題 | No.39 桁の数字を入れ替え |
| コンテスト | |
| ユーザー |
AreTrash
|
| 提出日時 | 2016-04-16 15:54:45 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 26 ms / 5,000 ms |
| コード長 | 761 bytes |
| 記録 | |
| コンパイル時間 | 842 ms |
| コンパイル使用メモリ | 111,892 KB |
| 実行使用メモリ | 18,816 KB |
| 最終ジャッジ日時 | 2024-10-02 06:54:20 |
| 合計ジャッジ時間 | 2,037 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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.Linq;
namespace No39_1{
public class Program{
public static void Main(string[] args){
var n = Console.ReadLine().ToCharArray();
var length = n.Length;
var max = 0;
for(var i = 0; i < length; i++){
for(var j = i; j < length; j++){
var tmp = new char[length];
n.CopyTo(tmp, 0);
var t = tmp[i];
tmp[i] = tmp[j];
tmp[j] = t;
string str = tmp.Aggregate(string.Empty, (current, c) => current + c);
max = Math.Max(max, int.Parse(str));
}
}
Console.WriteLine(max);
}
}
}
AreTrash