fork download
  1. import Data.List (intersperse)
  2. import Data.Char (chr)
  3. import Control.Applicative ((<$>))
  4. import System.IO (readLn)
  5.  
  6. triforce :: Int -> String
  7. triforce n | n > 0 = unlines rows
  8. where
  9. rows = row <$> [1..n]
  10. row i = let nbsp = chr 0x00A0
  11. triangle = chr 0x25B2
  12. offset = replicate (n - i) nbsp
  13. triangles = replicate i triangle
  14. in offset ++ intersperse nbsp triangles
  15.  
  16. main :: IO ()
  17. main = (readLn :: IO Int) >>= return . triforce >>= putStrLn
  18.  
Success #stdin #stdout 0s 6292KB
stdin
25
stdout
                        ▲
                       ▲ ▲
                      ▲ ▲ ▲
                     ▲ ▲ ▲ ▲
                    ▲ ▲ ▲ ▲ ▲
                   ▲ ▲ ▲ ▲ ▲ ▲
                  ▲ ▲ ▲ ▲ ▲ ▲ ▲
                 ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲
                ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲
               ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲
              ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲
             ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲
            ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲
           ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲
          ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲
         ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲
        ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲
       ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲
      ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲
     ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲
    ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲
   ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲
  ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲
 ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲
▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲