結果
問題 | No.1407 Kindness |
ユーザー |
👑 ![]() |
提出日時 | 2021-02-26 22:23:39 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 10 ms / 2,000 ms |
コード長 | 398 bytes |
コンパイル時間 | 1,944 ms |
コンパイル使用メモリ | 192,332 KB |
最終ジャッジ日時 | 2025-01-19 05:47:55 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 36 |
ソースコード
#include <bits/stdc++.h>using namespace std;using LL=long long;using ULL=unsigned long long;#define rep(i,n) for(int i=0; i<(n); i++)const ULL M=1000000007;int main(){string S; cin>>S;ULL ans=0;ULL m=1;rep(i,S.size()){int d=S[i]-'0';ans=(ans*45+m*(d*(d-1)/2))%M;m=m*d%M;}ULL sd=0; rep(i,S.size()-1) sd=(sd+1)*45%M;cout<<(ans+sd+m)%M<<endl;return 0;}