結果

問題 No.1086 桁和の桁和2
ユーザー kotatsugamekotatsugame
提出日時 2020-06-19 22:50:03
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 611 bytes
コンパイル時間 476 ms
コンパイル使用メモリ 64,856 KB
実行使用メモリ 5,880 KB
最終ジャッジ日時 2023-09-16 15:03:59
合計ジャッジ時間 6,307 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 WA -
testcase_05 AC 135 ms
5,880 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 84 ms
4,800 KB
testcase_11 AC 22 ms
4,376 KB
testcase_12 AC 6 ms
4,376 KB
testcase_13 AC 105 ms
5,212 KB
testcase_14 AC 67 ms
4,468 KB
testcase_15 AC 31 ms
4,376 KB
testcase_16 AC 178 ms
5,164 KB
testcase_17 AC 16 ms
4,376 KB
testcase_18 AC 245 ms
5,636 KB
testcase_19 AC 201 ms
5,212 KB
testcase_20 AC 26 ms
4,376 KB
testcase_21 AC 174 ms
4,920 KB
testcase_22 AC 243 ms
5,696 KB
testcase_23 AC 147 ms
4,760 KB
testcase_24 AC 104 ms
4,380 KB
testcase_25 AC 200 ms
5,416 KB
testcase_26 AC 169 ms
4,880 KB
testcase_27 AC 121 ms
4,664 KB
testcase_28 AC 104 ms
4,384 KB
testcase_29 AC 115 ms
4,380 KB
testcase_30 AC 247 ms
5,764 KB
testcase_31 AC 242 ms
5,664 KB
testcase_32 AC 243 ms
5,784 KB
testcase_33 AC 252 ms
5,632 KB
testcase_34 AC 246 ms
5,728 KB
testcase_35 AC 131 ms
5,704 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:7:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
    7 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
const long mod=1e9+7;
long power(long a,long b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}
int N;
long L[1<<17],R[1<<17],D[1<<17];
main()
{
	cin>>N;
	for(int i=0;i<N;i++)cin>>L[i];
	for(int i=0;i<N;i++)cin>>R[i];
	int zc=0;
	for(int i=0;i<N;i++)
	{
		cin>>D[i];
		if(D[i]==0)zc++;
	}
	if(zc>0)
	{
		if(zc==N)cout<<1<<endl;
		else cout<<0<<endl;
		return 0;
	}
	long ans=1;
	long inv9=power(9,mod-2);
	for(int i=0;i<N;i++)
	{
		long now=(power(10,R[i])-power(10,L[i])+mod)%mod*inv9%mod;
		if(i>0&&D[i-1]==D[i])now=(now+1)%mod;
		ans=ans*now%mod;
	}
	cout<<ans<<endl;
}
0