結果

問題 No.883 ぬりえ
ユーザー MiyamonYMiyamonY
提出日時 2019-10-07 09:13:09
言語 Scheme
(Gauche-0.9.14)
結果
RE  
実行時間 -
コード長 1,566 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 5,248 KB
実行使用メモリ 20,992 KB
最終ジャッジ日時 2024-04-20 19:05:26
合計ジャッジ時間 3,382 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
17,024 KB
testcase_01 AC 30 ms
16,896 KB
testcase_02 AC 29 ms
16,896 KB
testcase_03 AC 31 ms
17,024 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 AC 29 ms
17,024 KB
testcase_07 RE -
testcase_08 AC 28 ms
17,024 KB
testcase_09 RE -
testcase_10 AC 30 ms
17,024 KB
testcase_11 AC 29 ms
17,024 KB
testcase_12 AC 30 ms
17,024 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 AC 47 ms
20,992 KB
testcase_16 AC 38 ms
17,920 KB
testcase_17 AC 34 ms
17,280 KB
testcase_18 RE -
testcase_19 RE -
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

;;; File:  main.scm
;; Author: ymiyamoto
;;
;; Created on Mon Oct  7 02:32:46 2019
;;
(define-syntax read-number
  (syntax-rules ()
    ((_ nums)
     (define-values nums
       (apply values (map string->number (string-split (read-line) #\space)))))))

(define-syntax read-numbers
  (syntax-rules ()
    ((_ as)
     (define as (map string->number (string-split (read-line) #\space))))
    ((_ as n)
     (define as (map (lambda (_) (map string->number (string-split (read-line) #\space))) (iota n))))))

(define-syntax prlist
  (syntax-rules ()
    ((_ lis)
     (print (string-join (map number->string lis) " ")))))

(define-syntax 1+ (syntax-rules () ((_ x) (+ x 1))))

(define-syntax 1- (syntax-rules () ((_ x) (- x 1))))

(define MOD 1000000007)

(define (solve)
  (read-number (n k))
  (define-values (x y) (div-and-mod n (* k k)))
  (define-values (s l) (exact-integer-sqrt y))
  (define m (+ s (if (> l 0) 1 0)))

  (print (+ (* x k) m))
  (print (string-join
  	  (append (map (lambda (i)
  			 (string-join (map (lambda (_)
					     (string-append (make-string (* i k) #\.)
							    (make-string k #\#)
							    (make-string (+ (* k (- x 1 i)) m)  #\.)))
					   (iota k))
				      "\n"))
  		       (iota x))
  		  (map (lambda (_)
  			 (string-append (make-string (* x k) #\.)
  					(make-string s #\#)
  					(if (> l 0) #\. "")))

  		       (iota s))
  		  (map (lambda (_)
  			 (string-append (make-string (* x k) #\.)
  					(make-string l #\#)
  					(make-string (- s l) #\.)))
  		       (iota (if (> l 0) 1 0))))
  	  "\n")))

(solve)
0