fork download
  1. {-# LANGUAGE NoMonomorphismRestriction #-}
  2. import Control.Monad
  3. import Data.Char
  4.  
  5. razmer = 25
  6. sdvig = 0.2
  7.  
  8. main = getLine >>= mapM_ (printanutSnezhinku . zaebashitSnezhinku) . words
  9.  
  10. zaebashitSnezhinku slovo = snezhinka where
  11. snezhinka = stvoli ++ mnogougoljni4ki ++ veto4ki
  12.  
  13. summa = sum [ord c^p | (p,c) <- zip [1..] slovo]
  14. ugol = 2*pi/fI stvolov
  15. shag = fI (round (razmer/fI mnogougoljni4kov))
  16.  
  17. stvoli = [0,ugol..2*pi] >>= zaeboshitLiniju (0,0) razmer
  18. mnogougoljni4ki = [shag,2*shag..razmer-shag] >>= zaeboshitMnogougolni4ek ugol
  19. veto4ki = join [[t-pi/4,t+pi/4] >>= zaeboshitLiniju to4e4ka dlinaVeto4ki |
  20. t <- [0,ugol..2*pi], s <- [shag,2*shag..razmer-shag],
  21. let to4e4ka = zaeboshitTo4e4ku s t]
  22.  
  23. stvolov = mod summa (maxStvolov-minStvolov) + minStvolov
  24. mnogougoljni4kov = mod summa (maxMnogougoljni4kov-minMnogougoljni4kov) + minMnogougoljni4kov
  25.  
  26. maxStvolov = 13
  27. minStvolov = 3
  28. maxMnogougoljni4kov = 5
  29. minMnogougoljni4kov = 2
  30. dlinaVeto4ki = 4
  31.  
  32. printanutSnezhinku snezhinka =
  33. forM_ [razmer,razmer-1 .. -razmer] (\y ->
  34. forM_ [-razmer..razmer] (\x ->
  35. putStr [if elem (x,y) snezhinka then '#' else ' ',' ']) >>
  36. putChar '\n') >>
  37. putStrLn "\n"
  38.  
  39. zaeboshitTo4e4ku rasstojanie ugol =
  40. (round (rasstojanie*cos ugol),round (rasstojanie*sin ugol))
  41. zaeboshitLiniju (x0,y0) dlina ugol =
  42. map ((\(x1,y1) -> (x0+x1,y0+y1)) . (`zaeboshitTo4e4ku` ugol)) [0,sdvig..dlina]
  43. soedenit2To4e4ki (x0,y0) (x1,y1) = zaeboshitLiniju (x0,y0) rasstojanie ugol where
  44. rasstojanie = sqrt $ fI $ (x0-x1)^2 + (y0-y1)^2
  45. ugol = atan2 (fI (y1-y0)) (fI (x1-x0))
  46. zaeboshitMnogougolni4ek ugol dlina =
  47. join $ take (round (2*pi/ugol)) $ zipWith soedenit2To4e4ki to4e4ki (drop 1 to4e4ki) where
  48. to4e4ki = cycle (map (zaeboshitTo4e4ku dlina) [0,ugol..2*pi])
Success #stdin #stdout 2.19s 7308KB
stdin
купи гандонов и водяры и дуй ко мне!
stdout
                                                                                                      
                                      # #                                                             
                                        #                                                             
                                        #                                                             
                                        #     #                                                       
                                    #   # # #                                     #                   
                                      # # # #                                   #                     
                                        # # # #                         #     # #                     
                                      # # #   # # # # #                 #   # #                       
                                    # #   #           # # # #           # # #                         
                                  # #     # #   #           # # # # #   # #                           
                                # #   #     # #                     # # # # # # #                     
                              #         # # # #                 #     # # #                           
                #         # #             # # # #               #   # #   #                           
    # #         #       # #             # # # # # # # #         # # #     # #                         
      # # #     #     # #             # #     #       # # # #   # #         #                         
          # # #   # # #   #         # #       #     #     # # # # # # # #   # #                       
                # #       #       # #     #   #   #       #   # # #           #                       
          # # #   # # #   #     # #   #     # # # #       # # #   #           # #                     
                  #     # # # # #     #       # # # #     # #     # #           #                     
                  #       # # # #     #     # # #     # # # # # # # #           # #                   
                  # # # #   #   # # #   # # #   #       # # #         #           #                   
                  #         #       # # # #     #     # #   #       # # #       # # #       #         
                  #         #   # # #   # # #   # # # #     #     #     #     #     #     #           
                  #         #           #   # # # # #       # # #       # # #       # # #             
                  #         #           #       # # # # # # # # # # # # # # # # # # # # # # # # # # # 
                  #         #           #   # # # # #       # # #       # # #       # # #             
                  #         #   # # #   # # #   # # # #     #     #     #     #     #     #           
                  #         #       # # # #     #     # #   #       # # #       # # #       #         
                  # # # #   #   # # #   # # #   #       # # #         #           #                   
                  #       # # # #     #     # # #     # # # # # # # #           # #                   
                  #     # # # # #     #       # # # #     # #     # #           #                     
          # # #   # # #   #     # #   #     # # # #       # # #   #           # #                     
                # #       #       # #     #   #   #       #   # # #           #                       
          # # #   # # #   #         # #       #     #     # # # # # # # #   # #                       
      # # #     #     # #             # #     #       # # # #   # #         #                         
    # #         #       # #             # # # # # # # #         # # #     # #                         
                #         # #             # # # #               #   # #   #                           
                              #         # # # #                 #     # # #                           
                                # #   #     # #                     # # # # # # #                     
                                  # #     # #   #           # # # # #   # #                           
                                    # #   #           # # # #           # # #                         
                                      # # #   # # # # #                 #   # #                       
                                        # # # #                         #     # #                     
                                      # # # #                                   #                     
                                    #   # # #                                     #                   
                                        #     #                                                       
                                        #                                                             
                                        #                                                             
                                      # #                                                             
                                                                                                      


                                                                                                      
                                  #                               #                                   
                                  # #                           # #                                   
                                    #                           #                                     
                                    #                           #                                     
                                    # #                       # #                                     
                                      #                       #                                       
                                      #                       #                                       
                                      # #                   # #                                       
                                        #                   #                                         
          #                             #     #       #     #                             #           
          # #                           # # # #       # # # #                           # #           
              # #                 # #     # #           # #     # #                 # #               
                # #                 # # # # #           # # # # #                 # #                 
                  # #       #           # # # # # # # # # # #           #       # #                   
                      # #   # #       # #   #           #   # #       # #   # #                       
                        # #   #   # # #     #           #     # # #   #   # #                         
                          # # # # #         # #       # #         # # # # #                           
                        # # # # #             #       #             # # # # #                         
                      # #     # # #           #       #           # # #     # #                       
                            # #     # #       # #   # #       # #     # #                             
                            #         # #       #   #       # #         #                             
                    #       #           # #     #   #     # #           #       #                     
                      #   # #               # # # # # # #               # #   #                       
                        # #                   # # # # #                   # #                         
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
                        # #                   # # # # #                   # #                         
                      #   # #               # # # # # # #               # #   #                       
                    #       #           # #     #   #     # #           #       #                     
                            #         # #       #   #       # #         #                             
                            # #     # #       # #   # #       # #     # #                             
                      # #     # # #           #       #           # # #     # #                       
                        # # # # #             #       #             # # # # #                         
                          # # # # #         # #       # #         # # # # #                           
                        # #   #   # # #     #           #     # # #   #   # #                         
                      # #   # #       # #   #           #   # #       # #   # #                       
                  # #       #           # # # # # # # # # # #           #       # #                   
                # #                 # # # # #           # # # # #                 # #                 
              # #                 # #     # #           # #     # #                 # #               
          # #                           # # # #       # # # #                           # #           
          #                             #     #       #     #                             #           
                                        #                   #                                         
                                      # #                   # #                                       
                                      #                       #                                       
                                      #                       #                                       
                                    # #                       # #                                     
                                    #                           #                                     
                                    #                           #                                     
                                  # #                           # #                                   
                                  #                               #                                   
                                                                                                      


                                                                                                      
                                                                                                      
                                                                                                      
                        #                                                                             
                          #                                                                           
                          # #                                                                         
                            #                                                                         
                            # #                                                                       
                              #                                                                       
                              # #                                                                     
                                # #                                                                   
                                  #     #                                                             
                                  # #   #                                                             
                                    # # #                                                             
                              # # # # #                                                               
                                  # # # #                                                             
                                      # # # #                                                         
                                      # # # # #                                                       
                                      #   #     # #                                                   
                                      #   # #     # # #                                               
                                      #     #         # # #                                           
                                      #     # #           # # #                                       
                                      #       # #             # #               #                     
                                      #         #                 # #         #                       
                                      #         # #                 # # #   #                         
                                      #           # # # # # # # # # # # # # # # # # # # # # # # # # # 
                                      #         # #                 # # #   #                         
                                      #         #                 # #         #                       
                                      #       #               # #               #                     
                                      #     # #           # # #                                       
                                      #     #         # # #                                           
                                      #   # #     # # #                                               
                                      #   #     # #                                                   
                                      # # # # #                                                       
                                      # # # #                                                         
                                  # # # #                                                             
                              # # # # #                                                               
                                    # # #                                                             
                                  # #   #                                                             
                                  #     #                                                             
                                # #                                                                   
                              # #                                                                     
                              #                                                                       
                            # #                                                                       
                            #                                                                         
                          # #                                                                         
                          #                                                                           
                        #                                                                             
                                                                                                      
                                                                                                      
                                                                                                      


                                          #                                                           
                                          # #                                                         
                                            #                         #                               
                                            #                         #                               
                                            #                       # #                               
                                            #                       #                                 
                  #                         #                     # #                                 
                  # #                       #                     #                                   
                    # #                     # #                   #                                   
                      # #                     #                 #                                     
                        #                     #   #       #     #                                     
                          #             # #   # # #       #   # #                           #         
                          # #     #       # # # #         #   #                           # #         
                            # #   #         # # # # #     # # # # # #                 # #             
                              # # #     # # # #       # # # # #                   # # #               
                                # # # # #     # #         # # #         #       # #                   
                          # # # # # #           #         #     #       #   # # #                     
                                # # #           #       # #       #   # # # #                         
  # # #               #       # #     #         #       #           # # # #                           
      # # # #         # #     #       # #       #       #           # # # #                           
            # # # # #   #   # #         # #     #     #         # #   #   # # #                       
                    # # # # #             # #   #     #       # #       #                             
                        # # # # #           # #   # # #   # #           #       #                     
                    # # # #       # # # #     # # # # # # #             #     #                       
                  # #     #             # # # # # # # #                   # #                         
                          #                   # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
                  # #     #             # # # # # # # #                   # #                         
                    # # # #       # # # #     # # # # # # #             #     #                       
                        # # # # #           # #   # # #   # #           #       #                     
                    # # # # #             # #   #     #       # #       #                             
            # # # # #   #   # #         # #     #     #         # #   #   # # #                       
      # # # #         # #     #       # #       #       #           # # # #                           
  # # #               #       # #     #         #       #           # # # #                           
                                # # #           #       # #       #   # # # #                         
                          # # # # # #           #         #     #       #   # # #                     
                                # # # # #     # #         # # #         #       # #                   
                              # # #     # # # #       # # # # #                   # # #               
                            # #   #         # # # # #     # # # # # #                 # #             
                          # #     #       # # # #         #   #                           # #         
                          #             # #   # # #       #   # #                           #         
                        #                     #   #       #     #                                     
                      # #                     #                 #                                     
                    # #                     # #                   #                                   
                  # #                       #                     #                                   
                  #                         #                     # #                                 
                                            #                       #                                 
                                            #                       # #                               
                                            #                         #                               
                                            #                         #                               
                                          # #                                                         
                                          #                                                           


                                                                                                      
                                                                                                      
                                                                                                      
                        #                                                                             
                          #                                                                           
                          # #                                                                         
                            #                                                                         
                            # #                                                                       
                              #                                                                       
                              # #                                                                     
                                # #                                                                   
                                  #     #                                                             
                                  # #   #                                                             
                                    # # #                                                             
                              # # # # #                                                               
                                  # # # #                                                             
                                      # # # #                                                         
                                      # # # # #                                                       
                                      #   #     # #                                                   
                                      #   # #     # # #                                               
                                      #     #         # # #                                           
                                      #     # #           # # #                                       
                                      #       # #             # #               #                     
                                      #         #                 # #         #                       
                                      #         # #                 # # #   #                         
                                      #           # # # # # # # # # # # # # # # # # # # # # # # # # # 
                                      #         # #                 # # #   #                         
                                      #         #                 # #         #                       
                                      #       #               # #               #                     
                                      #     # #           # # #                                       
                                      #     #         # # #                                           
                                      #   # #     # # #                                               
                                      #   #     # #                                                   
                                      # # # # #                                                       
                                      # # # #                                                         
                                  # # # #                                                             
                              # # # # #                                                               
                                    # # #                                                             
                                  # #   #                                                             
                                  #     #                                                             
                                # #                                                                   
                              # #                                                                     
                              #                                                                       
                            # #                                                                       
                            #                                                                         
                          # #                                                                         
                          #                                                                           
                        #                                                                             
                                                                                                      
                                                                                                      
                                                                                                      


                                          #                                                           
                                          # #                                                         
                                            #                         #                               
                                            #                         #                               
                                            #                       # #                               
                                            #                       #                                 
                  #                         #     #           #   # #                                 
                  # #                   # # #   # #           #   #                                   
                    # #                   # # # #             #   #                                   
                      # #     #             # # # # # #       # # # # # #                             
                        #     #         # # # #         # # # # # #                                   
                          #   #     # # #     #               # # #                         #         
                          # # # # # #         #               #     #         #           # #         
                      # # # # # #             #             # #       #       #       # #             
                            # # #             #     # #     #           #   # #   # # #               
                          # #   # #     # # # # # # # #   # #             # #   # #                   
                #         #       # #   #   # # # #   #   #                 # # #                     
                # #     #           #   #     # # # # # # # # # # #       # #   # # #                 
  # # #           #   # #             # # # # # #   # # # #       #   # # #   #                       
      # # # #     # # #       # # # # # # #     #       # # #   # # # #       #                       
            # # # # #         # #     # # #     #     #     # # # #           #                       
              # # # # # # #     #   # #   # #   #     #       # # # #           #                     
            # #     #     # # # # # #       # #   # # #   # #   #   # # #       #       #             
                    #           # # # # #     # # # # # # #     # #   #         #     #               
                    #       # # # #     # # # # # # # #           # #             # #                 
                    #     # #     #           # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
                    #       # # # #     # # # # # # # #           # #             # #                 
                    #           # # # # #     # # # # # # #     # #   #         #     #               
            # #     #     # # # # # #       # #   # # #   # #   #   # # #       #       #             
              # # # # # # #     #   # #   # #   #     #       # # # #           #                     
            # # # # #         # #     # # #     #     #     # # # #           #                       
      # # # #     # # #       # # # # # # #     #       # # #   # # # #       #                       
  # # #           #   # #             # # # # # #   # # # #       #   # # #   #                       
                # #     #           #   #     # # # # # # # # # # #       # #   # # #                 
                #         #       # #   #   # # # #   #   #                 # # #                     
                          # #   # #     # # # # # # # #   # #             # #   # #                   
                            # # #             #     # #     #           #   # #   # # #               
                      # # # # # #             #             # #       #       #       # #             
                          # # # # # #         #               #     #         #           # #         
                          #   #     # # #     #               # # #                         #         
                        #     #         # # # #         # # # # # #                                   
                      # #     #             # # # # # #       # # # # # #                             
                    # #                   # # # #             #   #                                   
                  # #                   # # #   # #           #   #                                   
                  #                         #     #           #   # #                                 
                                            #                       #                                 
                                            #                       # #                               
                                            #                         #                               
                                            #                         #                               
                                          # #                                                         
                                          #                                                           


                                          #                                                           
                                          # #                                                         
                                            #                         #                               
                                            #                         #                               
                                            #   #                   # #                               
                                      # #   # # #             #     #                                 
                  #                     # # # #               #   # #                                 
                  # #     #               # # # #             #   #                                   
                    # #   #           # # # # #   # # # # #   # # # # # #                             
                      # # #       # # #       #             # # # #                                   
                        # # # # #             #   #       #     # # #                                 
                  # # # # # #           # #   # # #       #   # #   # #           #         #         
                        # # #     #       # # # #         #   #       # # #       #       # #         
                        #   # #   #         # # # # #     # # # # # #     # #   # #   # #             
                      # #     # # #     # # # #       # # # # #             # # # # # #               
                      #         # # # # #     # #         # # #         #     # # # #                 
            #       #     # # # # # #     #     #   #     #     #       #   # # #   # # #             
            # #   # #           # # #     # #   # # #   # #       #   # # # #   # #                   
  # # #       #   #   #       # #     #   # # # # # #   #     #     # # # #       #                   
      # # # # # # #   # #     #   #   # # #   # # # # # # # # #     # # # #       #                   
            # # # # #   #   # #   # # # # # #   #   # # #   # # # #   #   # # #   # #                 
          # # # #   # # # # #       #   # # #   #     # # # # # #       #           #                 
        # #     #       # # # # #   # # #   # #   # # #   # # # #   #   #       #   #       #         
                #   # # # #       # # # #     # # # # # # # #   # # #   #     #     # #   #           
                # # #     #     # # # # # # # # # # # #       # #         # #         # #             
                #         #   # #     #       # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
                # # #     #     # # # # # # # # # # # #       # #         # #         # #             
                #   # # # #       # # # #     # # # # # # # #   # # #   #     #     # #   #           
        # #     #       # # # # #   # # #   # #   # # #   # # # #   #   #       #   #       #         
          # # # #   # # # # #       #   # # #   #     # # # # # #       #           #                 
            # # # # #   #   # #   # # # # # #   #   # # #   # # # #   #   # # #   # #                 
      # # # # # # #   # #     #   #   # # #   # # # # # # # # #     # # # #       #                   
  # # #       #   #   #       # #     #   # # # # # #   #     #     # # # #       #                   
            # #   # #           # # #     # #   # # #   # #       #   # # # #   # #                   
            #       #     # # # # # #     #     #   #     #     #       #   # # #   # # #             
                      #         # # # # #     # #         # # #         #     # # # #                 
                      # #     # # #     # # # #       # # # # #             # # # # # #               
                        #   # #   #         # # # # #     # # # # # #     # #   # #   # #             
                        # # #     #       # # # #         #   #       # # #       #       # #         
                  # # # # # #           # #   # # #       #   # #   # #           #         #         
                        # # # # #             #   #       #     # # #                                 
                      # # #     # # #         #             # # # #                                   
                    # #   #           # # # # #   # # # # #   # # # # # #                             
                  # #     #               # # # #             #   #                                   
                  #                     # # # #               #   # #                                 
                                      # #   # # #             #     #                                 
                                            #   #                   # #                               
                                            #                         #                               
                                            #                         #                               
                                          # #                                                         
                                          #                                                           


                                                                                                      
                                                                                                      
                                                                                                      
                        #                                                   #                         
                          #                                               #                           
                          # #     #                               #     # #                           
                            #     #                               #     #                             
                            # # # #                               # # # #                             
                        # # # # #                                   # # # # #                         
                            # # # # # # # # # # # # # # # # # # # # # # #                             
                              # # #                               # # #                               
                              #   #     #                   #     #   #                               
                            # #   # #   #                   #   # #   # #                             
                            #       # # #                   # # #       # #                           
                          #   # # # # #                       # # # # #   #                           
                        # #       # # # # # # # # # # # # # # # # #       # #                         
                        #           # # #     #       #     # # #           #                         
                      # #           #   # #   #       #   # #   #           # #                       
                      #           #       # # #       # # #       #           #                       
                    # #         # # # # # # #           # # # # # # #         # #                     
                    #           #       # # # # # # # # # # #       #           #                     
                  # #         # #         # # #       # # #         # #           #                   
        #       # # #         # #         #   # #     #   #         # #         # # #       #         
          #     #     #     #     #     #       #   #       #     #     #     #     #     #           
            # # #       # # #       # # #       # # #       # # #       # # #       # # #             
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
            # # #       # # #       # # #       # # #       # # #       # # #       # # #             
          #     #     #     #     #     #       #   #       #     #     #     #     #     #           
        #       # # #         # #         #   # #     #   #         # #         # # #       #         
                  #           # #         # # #       # # #         # #         # #                   
                    #           #       # # # # # # # # # # #       #           #                     
                    # #         # # # # # # #           # # # # # # #         # #                     
                      #           #       # # #       # # #       #           #                       
                      # #           #   # #   #       #   # #   #           # #                       
                        #           # # #     #       #     # # #           #                         
                        # #       # # # # # # # # # # # # # # # # #       # #                         
                          #   # # # # #                       # # # # #   #                           
                          # #       # # #                   # # #       #                             
                            # #   # #   #                   #   # #   # #                             
                              #   #     #                   #     #   #                               
                              # # #                               # # #                               
                            # # # # # # # # # # # # # # # # # # # # # # #                             
                        # # # # #                                   # # # # #                         
                            # # # #                               # # # #                             
                            #     #                               #     #                             
                          # #     #                               #     # #                           
                          #                                               #                           
                        #                                                   #