結果

問題 No.1407 Kindness
コンテスト
ユーザー ygussany
提出日時 2021-02-26 21:31:12
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
WA  
実行時間 -
コード長 500 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 157 ms
コンパイル使用メモリ 39,268 KB
最終ジャッジ日時 2026-02-22 06:52:32
ジャッジサーバーID
(参考情報)
judge2 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2
other WA * 36
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:4:11: warning: built-in function 'pow' declared as non-function [-Wbuiltin-declaration-mismatch]
    4 | long long pow[100001];
      |           ^~~

ソースコード

diff #
raw source code

#include <stdio.h>

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

long long recursion(int l, char N[])
{
	if (N[0] == 0 || N[0] == '0') return 0;
	else return (recursion(l - 1, &(N[1])) * (N[0] - '0' - 1) + 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, N));	
	fflush(stdout);
	return 0;
}
0