結果
| 問題 |
No.170 スワップ文字列(Easy)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-08-07 10:10:21 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 694 bytes |
| コンパイル時間 | 930 ms |
| コンパイル使用メモリ | 110,948 KB |
| 実行使用メモリ | 36,716 KB |
| 最終ジャッジ日時 | 2024-11-07 04:44:27 |
| 合計ジャッジ時間 | 7,796 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | AC * 1 TLE * 1 -- * 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.Generic;
class SwapString
{
static void Main(String[] args)
{
String S = Console.ReadLine();
Queue<String> countQueue = new Queue<String>();
Queue<String> uniqueQueue = new Queue<String>();
countQueue.Enqueue(S);
uniqueQueue.Enqueue(S);
while(countQueue.Count > 0)
{
String s = countQueue.Dequeue();
for(int i=0; i < s.Length-1; i++)
{
char[] arr = s.ToCharArray();
char temp = arr[i+1];
arr[i+1] = arr[i];
arr[i] = temp;
String t = new String(arr);
if(!uniqueQueue.Contains(t))
{
countQueue.Enqueue(t);
uniqueQueue.Enqueue(t);
}
}
}
Console.WriteLine(uniqueQueue.Count-1);
}
}