結果
問題 | No.1177 余りは? |
ユーザー |
|
提出日時 | 2023-04-30 18:15:25 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 125 ms / 1,000 ms |
コード長 | 473 bytes |
コンパイル時間 | 4,007 ms |
コンパイル使用メモリ | 251,436 KB |
最終ジャッジ日時 | 2025-02-12 16:09:17 |
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 32 |
ソースコード
#include <bits/stdc++.h>using namespace std;#include <atcoder/all>using mint = atcoder::modint1000000007;int main() {int p, k;cin >> p >> k;vector<int> a;int c = 1;for (int i = 0; i < p; i++){while (c < p){c *= 10;a.push_back(0);}a.pop_back();a.push_back(c / p);c -= c / p * p;}mint ans = 0;for (int i = 2; i < p + 1; i++){ans += mint(a[p - i]) * mint(10).pow(i - 2);}if (k == 0){ans++;}cout << ans.val() << endl;}