結果

問題 No.1580 I like Logarithm!
ユーザー kotatsugamekotatsugame
提出日時 2021-07-02 21:40:03
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 347 bytes
コンパイル時間 581 ms
コンパイル使用メモリ 67,200 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-29 11:11:29
合計ジャッジ時間 1,823 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 39
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    7 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<atcoder/modint>
using namespace std;
using mint=atcoder::modint1000000007;
int A;
string B;
main()
{
	cin>>A>>B;
	int L=0;
	mint P=1;
	mint ans=0;
	for(int i=B.size();--i;)
	{
		ans+=(P*A-P)*L;
		L++;
		P*=A;
	}
	mint Q=0;
	for(int i=0;i<B.size();i++)
	{
		Q=Q*A+B[i]-'0';
	}
	ans+=(Q+1-P)*L;
	cout<<ans.val()<<endl;
}
0