結果
| 問題 |
No.39 桁の数字を入れ替え
|
| コンテスト | |
| ユーザー |
AreTrash
|
| 提出日時 | 2016-04-16 15:53:33 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 765 bytes |
| コンパイル時間 | 1,012 ms |
| コンパイル使用メモリ | 106,752 KB |
| 実行使用メモリ | 18,688 KB |
| 最終ジャッジ日時 | 2024-10-04 10:16:03 |
| 合計ジャッジ時間 | 2,150 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 18 WA * 1 |
コンパイルメッセージ
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 + 1; 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