結果
| 問題 |
No.1410 A lot of Bit Operations
|
| コンテスト | |
| ユーザー |
trineutron
|
| 提出日時 | 2021-02-27 00:30:07 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 712 bytes |
| コンパイル時間 | 2,108 ms |
| コンパイル使用メモリ | 196,604 KB |
| 最終ジャッジ日時 | 2025-01-19 07:28:16 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 44 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/modint>
using namespace std;
using namespace atcoder;
using mint = modint1000000007;
const vector<int> c{0, 1, 1, 2, 1, 2, 2, 3};
int main()
{
int64_t n;
cin >> n;
string k;
cin >> k;
if (n == 0)
{
cout << count(k.begin(), k.end(), 'o') << endl;
return 0;
}
mint ans = 0;
for (int i = 0; i < 8; i++)
{
if (k.at(i) == 'o')
{
ans += mint(2).pow(2 * n);
if (n > 1)
{
ans += (c[i] * c[i] + (4 - c[i]) * (4 - c[i])) * (mint(2).pow(n - 1) - 1) * mint(2).pow(2 * n - 4);
}
}
}
ans *= 2;
cout << ans.val() << endl;
}
trineutron