Add tags

Add tags to the following comment

 殆ど書き直しです。エレガントに書けたと思います。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//http://ja.doukaku.org/103/ 投稿用
using System;
using System.Collections.Generic;
class Program {
    static void Main(string[] args) {
        Amida(@"A B C D E
| | |-| |
|-| | |-|
| |-| |-|
|-| |-| |
|-| | | |");
        Console.ReadLine();
    }

    static void Amida(string amidaText) {
        List<string> temp = new List<string>(amidaText.Split(new char[] { '\n' }));
        List<char> lastLine = new List<char>(temp[0].ToCharArray());
        foreach(string line in temp) {
            Console.WriteLine(line);
            for(int i = 1; i < line.Length; i = i + 2) {
                if(line[i] == '-'){
                    lastLine.Reverse(i - 1, 3);
                }
            }
        }
        Console.WriteLine(lastLine.ToArray());
    }
}

Add tags

The input will be splited to tags with space.

Index

Feed

Other

Link

Pathtraq

loading...