結果
問題 | No.528 10^9と10^9+7と回文 |
ユーザー | oshibori |
提出日時 | 2017-06-10 00:06:40 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,529 bytes |
コンパイル時間 | 1,384 ms |
コンパイル使用メモリ | 163,016 KB |
実行使用メモリ | 4,964 KB |
最終ジャッジ日時 | 2023-10-24 03:33:08 |
合計ジャッジ時間 | 2,424 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,348 KB |
testcase_01 | AC | 2 ms
4,348 KB |
testcase_02 | AC | 2 ms
4,348 KB |
testcase_03 | AC | 2 ms
4,348 KB |
testcase_04 | AC | 2 ms
4,348 KB |
testcase_05 | AC | 2 ms
4,348 KB |
testcase_06 | AC | 2 ms
4,348 KB |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | AC | 5 ms
4,964 KB |
ソースコード
#include "bits/stdc++.h" using namespace std; #ifdef _DEBUG #include "dump.hpp" #else #define dump(...) #endif #define int long long #define rep(i,a,b) for(int i=(a);i<(b);i++) #define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--) #define all(c) begin(c),end(c) const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f; const int MOD = (int)(1e9) + 7; const double PI = acos(-1); const double EPS = 1e-9; template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; } signed main() { cin.tie(0); ios::sync_with_stdio(false); string in; cin >> in; int mod1((int)(1e9)); dump(mod1, MOD); vector<int>s1(in.size()), s2(in.size()); s1[0] = s2[0] = 0; int x1(1), x2(1); rep(i, 1, in.size()) { s1[i] = (s1[i - 1] + (9 * x1) % mod1) % mod1; s2[i] = (s2[i - 1] + (9 * x2) % MOD) % MOD; if (!(i & 1))(x1 *= 10) %= mod1, (x2 *= 10) %= MOD; dump(s1[i], s2[i]); } int a1(1), a2(1); for (int i = 0; (in.size() & 1 ? i <= in.size() / 2 : i < in.size() / 2); i++) { if (i) { (a1 *= 1+min(in[i] - '0', in[in.size() - 1 - i] - '0')) %= mod1; (a2 *= 1+min(in[i] - '0', in[in.size() - 1 - i] - '0')) %= MOD; } else { (a1 *= min(in[i] - '0', in[in.size() - 1 - i] - '0')) %= mod1; (a2 *= min(in[i] - '0', in[in.size() - 1 - i] - '0')) %= MOD; } } cout << (a1 + s1.back()) % mod1 << endl; cout << (a2 + s2.back()) % MOD << endl; return 0; }