結果

問題 No.1407 Kindness
ユーザー publflpublfl
提出日時 2021-02-26 21:31:55
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 689 bytes
コンパイル時間 246 ms
コンパイル使用メモリ 33,664 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-10 12:05:00
合計ジャッジ時間 1,391 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,940 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,940 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 1 ms
6,940 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 1 ms
6,944 KB
testcase_12 AC 5 ms
6,940 KB
testcase_13 AC 2 ms
6,944 KB
testcase_14 AC 3 ms
6,940 KB
testcase_15 AC 5 ms
6,944 KB
testcase_16 AC 4 ms
6,940 KB
testcase_17 AC 3 ms
6,940 KB
testcase_18 AC 3 ms
6,940 KB
testcase_19 AC 5 ms
6,940 KB
testcase_20 AC 4 ms
6,940 KB
testcase_21 AC 2 ms
6,940 KB
testcase_22 AC 2 ms
6,940 KB
testcase_23 AC 4 ms
6,944 KB
testcase_24 AC 6 ms
6,944 KB
testcase_25 WA -
testcase_26 AC 3 ms
6,944 KB
testcase_27 AC 2 ms
6,940 KB
testcase_28 AC 5 ms
6,944 KB
testcase_29 AC 2 ms
6,940 KB
testcase_30 AC 5 ms
6,944 KB
testcase_31 AC 3 ms
6,944 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 5 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <string.h>
#define MOD 1000000007

char x[100010];
int y[100010];
long long int sum[100010],sum2[100010];
int main()
{
	scanf("%s",x+1);
	int a = strlen(x+1);
	for(int i=1;i<=a;i++) y[i] = x[i]-'0';
	
	sum[a+1] = 1;
	for(int i=a;i>=1;i--)
	{
		sum[i] = 45*sum[i+1];
		sum[i]%=MOD;
	}
	for(int i=a;i>=1;i--) sum2[i] = sum2[i+1] + sum[i], sum2[i]%=MOD;
	
	long long int ans = 0;
	long long int C = 1;
	for(int i=1;i<=a;i++)
	{
		long long int t = (C*sum[i+1])%MOD;
		t *= (y[i]*(y[i]-1)/2);
		t %= MOD;
		ans += t;
		ans %= MOD;
		C *= y[i];
	}
	
	long long int temp = 1;
	for(int i=1;i<=a;i++) temp *= y[i], temp%=MOD;
	printf("%lld\n",(ans+sum2[2]+temp)%MOD);
}
0