結果
問題 | No.1291 小手調べ |
ユーザー |
|
提出日時 | 2020-11-21 02:20:16 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 84 ms / 2,000 ms |
コード長 | 2,090 bytes |
コンパイル時間 | 414 ms |
コンパイル使用メモリ | 7,296 KB |
実行使用メモリ | 12,288 KB |
最終ジャッジ日時 | 2024-07-23 14:21:00 |
合計ジャッジ時間 | 1,883 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 4 |
コンパイルメッセージ
Syntax OK
ソースコード
DEBUG = falseMOD = 10**9+7YESNO = %w(Yes No)def main@N = int@N.times dod = intif d == 1puts 10elseputs 10**d - 10**(d-1)endendenddef int; gets.to_i; enddef ints; gets.split.map &:to_i; enddef float; gets.to_f; enddef floats; gets.split.map &:to_f; enddef array(&convert); gets.split.map(&convert); enddef string; gets.chomp; enddef rep(n, &b); Array.new(n, &b); enddef yes; puts YESNO[0]; enddef no; puts YESNO[1]; enddef yesno t; t ? yes : no; enddef zip(xs, *yss); Enumerator.new { |y| xs.zip(*yss) { |a| y.yield(*a) } }; enddef sorted_uniq(xs); x = nil; xs.filter! { |y| c = x === y; x = y; !c }; enddef max(*xs); xs.max; enddef min(*xs); xs.min; enddef minmax(*xs); xs.minmax; enddef matrix(h, w, fill=nil, &block); return Array.new(h) { Array.new(w, &block) } if block_given?; Array.new(h) { [fill] * w }; enddef debug(x); if DEBUG; STDERR.puts (block_given? ? yield(x) : x).inspect; end; x; enddef debug_grid(grid, width = 1); grid.each { |row| STDERR.puts row.map { |x| x.inspect.ljust(width) }.join("") } if DEBUG; grid; enddef if_debug; yield if DEBUG; enddef div_ceil(x, y); (x + y - 1) / y; enddef gcd(*xs); xs.inject(0) { |y, x| y.gcd(x) }; enddef factorial(n, mod); (2..n).inject(1) { |f, x| f * x % mod }; enddef cumsum(xs); ys = [0]; xs.each { |x| ys << x + ys[-1] }; ys; enddef cumdiff(ys); xs = []; xs.inject { |x, y| xs << (d = y - x); d }; enddef cumfold(ys, range); r = range.end; r -= 1 if range.exclusive_end?; ys[r] - ys[range.begin-1]; enddef mod_inv(x, mod); x.pow(mod-2, mod); enddef mod_div(x, y, mod); x * mod_inv(y, mod) % mod; enddef bitbrute(size, &block); (1<<size).times(&block); endclass UnionFinddef initialize(size); @p, @r = size.times.to_a, [1] * size; enddef merge(i, j); k, l = leader(i), leader(j); return if k == l; k, l = l, k if @r[k] < @r[l]; @p[l] = k; @r[k] += @r[l]; enddef size(i); @r[leader(i)]; enddef same?(i, j); leader(i) == leader(j); enddef leader(i); j = i; until i == @p[i]; j, i = i, @p[j] = @p[i]; end; i; endendmain