Codingame『May the Triforce be with you!』

triforcetriforce / uofigemd73
 ゼルダ詳しくないんですけど、トライフォースって何なんですかね。


www.codingame.com


細かくし過ぎた感がある

 一つの三角形を作るのに、
スペース部分、左部分、中央、右部分(左部分と同じ)……と分け過ぎた気がする。
もっと単純にforでぐるぐる回した方がよかったかなぁ?


 あと、ドットが邪魔。

Source code
using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;

/**
 * Auto-generated code below aims at helping you parse
 * the standard input according to the problem statement.
 **/
class Solution
{
    static string dot = ".";
    static string star = "*";
    static string space = " ";
    static int N;
    
    static void Main(string[] args)
    {
        N = int.Parse(Console.ReadLine());
        
        Get_TRIFORCE(Margin(), BlackSankaku(), WhiteSankaku());        
    }
    
    //黒い逆三角形を作成(スペース部分)
    static string[] BlackSankaku()
    {
        string[] delta = new string[N];

        for(int i = 0; i < N; i++) {
            for(int j = N-1-i; j > 0 ; j--) {
                delta[i] += space;
            }
        }
        
        return delta;
    }

    //白い直角三角形を作成
    static string[] WhiteSankaku()
    {
        string[] delta = new string[N];

        for(int i = 0; i < N; i++) {
            for(int j = i; j > 0 ; j--) {
                delta[i] += star;
            }
        }
        
        return delta;
    }
    
    //ドットを含む広いスペ部分を作成
    static string[] Margin()
    {
        string[] margin = new string[N];
        
        for(int i = 0; i < N; i++) {
            for(int j = N; j > 0; j--) {
                if(i == 0 & j == N) margin[i]+=dot;
                else margin[i] += space;
            }
        }
        
        return margin;
    }

    //ゴマダレする    
    static void Get_TRIFORCE(string[] margin, string[] bdelta, string[] wdelta)
    {
        for(int i = 0; i < N; i++) {
            Console.WriteLine(string.Format("{0}{1}{2}{3}{4}",margin[i],bdelta[i],wdelta[i],star,wdelta[i]));
        }
        for(int i = 0; i < N; i++) {
            Console.Write(string.Format("{0}{1}{2}{3}{4}",bdelta[i],wdelta[i],star,wdelta[i],bdelta[i]));
            Console.Write(space);
            Console.WriteLine(string.Format("{0}{1}{2}{3}",bdelta[i],wdelta[i],star,wdelta[i]));
        }
    }
}