結果

問題 No.1407 Kindness
ユーザー 👑 ygussanyygussany
提出日時 2021-02-26 21:55:44
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 848 bytes
コンパイル時間 231 ms
コンパイル使用メモリ 30,720 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-10 12:35:32
合計ジャッジ時間 1,483 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 2 ms
6,944 KB
testcase_14 AC 2 ms
6,940 KB
testcase_15 AC 2 ms
6,944 KB
testcase_16 AC 2 ms
6,940 KB
testcase_17 AC 2 ms
6,940 KB
testcase_18 AC 2 ms
6,940 KB
testcase_19 AC 2 ms
6,940 KB
testcase_20 AC 2 ms
6,940 KB
testcase_21 AC 2 ms
6,940 KB
testcase_22 AC 2 ms
6,944 KB
testcase_23 AC 2 ms
6,944 KB
testcase_24 AC 2 ms
6,940 KB
testcase_25 AC 2 ms
6,940 KB
testcase_26 AC 2 ms
6,944 KB
testcase_27 AC 2 ms
6,944 KB
testcase_28 AC 2 ms
6,944 KB
testcase_29 AC 2 ms
6,940 KB
testcase_30 AC 2 ms
6,944 KB
testcase_31 AC 2 ms
6,940 KB
testcase_32 AC 5 ms
6,940 KB
testcase_33 AC 3 ms
6,944 KB
testcase_34 AC 3 ms
6,944 KB
testcase_35 AC 2 ms
6,940 KB
testcase_36 AC 2 ms
6,940 KB
testcase_37 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:4:11: warning: built-in function 'pow' declared as non-function [-Wbuiltin-declaration-mismatch]
    4 | long long pow[100001];
      |           ^~~

ソースコード

diff #

#include <stdio.h>

const int Mod = 1000000007;
long long pow[100001];

long long div_mod(long long x, long long y, long long z)
{
	if (x % y == 0) return x / y;
	else return (div_mod((1 + x / y) * y - x, (z % y), y) * z + x) / y;
}

long long recursion(int l, char N[])
{
	if (l == 0 || N[0] == '0') return 0;
	else if (l == 1) return (N[0] - '0') * (N[0] - '0' + 1) / 2;
	else return (recursion(l - 1, &(N[1])) * (N[0] - '0') + pow[l-1] * (N[0] - '0') * (N[0] - '0' - 1) / 2) % Mod;
}

int main()
{
	char N[100001];
	scanf("%s", N);
	
	int i, l;
	for (i = 1, pow[0] = 1; i <= 100000; i++) pow[i] = pow[i-1] * 45 % Mod;
	for (l = 0; N[l] != 0; l++);
	printf("%lld\n", (recursion(l - 1, &(N[1])) * (N[0] - '0') + pow[l-1] * (N[0] - '0') * (N[0] - '0' - 1) / 2 + div_mod((pow[l] - pow[1] + Mod) % Mod, 44, Mod)) % Mod);
	fflush(stdout);
	return 0;
}
0