結果
| 問題 | No.189 SUPER HAPPY DAY |
| コンテスト | |
| ユーザー |
紙ぺーぱー
|
| 提出日時 | 2015-04-18 02:54:56 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 2,132 bytes |
| 記録 | |
| コンパイル時間 | 1,378 ms |
| コンパイル使用メモリ | 27,076 KB |
| 最終ジャッジ日時 | 2026-03-05 10:04:56 |
| 合計ジャッジ時間 | 2,072 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
* Assertion at gc.c:1005, condition `is_ok (error)' not met, function:mono_gc_init_finalizer_thread, Couldn't create thread. Error 0x0 assembly:<unknown assembly> type:<unknown type> member:(null) ================================================================= Native Crash Reporting ================================================================= Got a SIGABRT while executing native code. This usually indicates a fatal error in the mono runtime or one of the native libraries used by your application. ================================================================= ================================================================= Native stacktrace: ================================================================= 0x558f3c58804b - /usr/bin/mono : 0x558f3c5883dd - /usr/bin/mono : 0x558f3c535087 - /usr/bin/mono : 0x558f3c5875cc - /usr/bin/mono : 0x14d23cc9c8d0 - /lib/x86_64-linux-gnu/libc.so.6 : 0x14d23ccfb9bc - /lib/x86_64-linux-gnu/libc.so.6 : pthread_kill 0x14d23cc9c79e - /lib/x86_64-linux-gnu/libc.so.6 : gsignal 0x14d23cc7f8cd - /lib/x86_64-linux-gnu/libc.so.6 : abort 0x558f3c4f73c4 - /usr/bin/mono : 0x558f3c7dc135 - /usr/bin/mono : 0x558f3c7f95be - /usr/bin/mono : 0x558f3c7f9c73 - /usr/bin/mono : monoeg_assertion_message 0x558f3c776f08 - /usr/bin/mono : 0x558f3c6649f6 - /usr/bin/mono : 0x558f3c4fa047 - /usr/bin/mono : 0x558f3c5087b6 - /usr/bin/mono : mono_main 0x558f3c4f74df - /usr/bin/mono : 0x14d23cc81578 - /lib/x86_64-linux-gnu/libc.so.6 : 0x14d23cc8163b - /lib/x86_64-linux-gnu/libc.so.6 : __libc_start_main 0x558f3c4f7b1e - /usr/bin/mono : _start ================================================================= Telemetry Dumper: ================================================================= Entering thread summarizer pause from 0x22893195241408x Finished thread summarizer pause from 0x22893195241408x. Failed to create breadcrumb file (null)/crash_hash_0x0 Waiting for dumping threads to resume ====================
ソースコード
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
static public class Program
{
static public void Main()
{
var max = BigInteger.Pow(10, 200);
const long mod = (long)1e9 + 9;
var S = readString(2).ValidateArray(x =>
{
var v = BigInteger.Parse(x);
return 1 <= v && v <= max;
});
readEOF();
var a = func(S[0]);
var b = func(S[1]);
long ans = 0;
for (int i = 1; i < Math.Min(a.Length, b.Length); i++)
ans = (ans + a[i] * b[i]) % mod;
Console.WriteLine(ans);
}
static long[] func(string str)
{
const long mod = (long)1e9 + 9;
var len = str.Length;
var max = len * 9;
var dp = new long[2, len + 1, max + 10];
dp[1, 0, 0] = 1;
for (int i = 0; i < len; i++)
for (int j = 0; j <= max; j++)
for (int k = 0; k < 10; k++)
{
if (k == str[i] - '0')
dp[1, i + 1, j + k] = (dp[1, i + 1, j + k] + dp[1, i, j]) % mod;
else if (k < str[i] - '0') dp[0, i + 1, j + k] = (dp[0, i + 1, j + k] + dp[1, i, j]) % mod;
dp[0, i + 1, j + k] = (dp[0, i + 1, j + k] + dp[0, i, j]) % mod;
}
var ret = new long[max + 10];
for (int i = 0; i <= max; i++)
ret[i] = (dp[0, len, i] + dp[1, len, i]) % mod;
return ret;
}
static string[] readString(int n)
{
var s = Console.ReadLine().Split(' ');
if (s.Length != n)
throw new Exception(string.Format("invalid input, expected{0} actual{1}", n, s.Length));
return s;
}
static void readEOF()
{
if (Console.In.Peek() >= 0)
throw new Exception("invalid input too long input file");
}
}
static public class Ex
{
static public T[] ValidateArray<T>(this T[] input, Func<T, bool> f)
{
foreach (var x in input)
if (!f(x))
throw new Exception("invalid input");
return input;
}
}
紙ぺーぱー