标签:技术 img return har mamicode for mic efi func
#include <bits/stdc++.h> #define ll long long using namespace std; int n, mod = 1000000007; char s[200005]; int main() { cin >> n >> s + 1; ll ans = 0; int flag = 0; for (int i = 1; s[i]; ++i) { if (s[i] == ‘1‘) ans = (ans + (ll)(1 + i) * i / 2 % mod * i % mod) % mod, flag = i; else if (flag) ans = (ans + (ll)(i + i - flag + 1) * flag / 2 % mod * flag % mod) % mod; } cout << ans << ‘\n‘; return 0; }
标签:技术 img return har mamicode for mic efi func
原文地址:https://www.cnblogs.com/2aptx4869/p/12636633.html