結果
| 問題 | No.1407 Kindness | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2021-02-26 21:31:33 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 6 ms / 2,000 ms | 
| コード長 | 446 bytes | 
| コンパイル時間 | 1,636 ms | 
| コンパイル使用メモリ | 167,456 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-10-02 14:02:24 | 
| 合計ジャッジ時間 | 2,653 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 36 | 
ソースコード
#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int mod=1000000007;
int ans,cnt=1,pp[1<<20];
signed main(){
    string s;cin>>s;
    pp[0]=1;
    for(int i=1;i<s.size();i++){
        pp[i]=pp[i-1]*45%mod;
        (ans+=pp[i])%=mod;
    }
    for(int i=0;i<s.size();i++){
        (ans+=(s[i]-'0')*(s[i]-'1')/2%mod*pp[s.size()-i-1]%mod*cnt%mod)%=mod;
        (cnt*=s[i]-'0')%=mod;
    }
    cout<<(ans+cnt)%mod<<endl;
}
            
            
            
        