結果
| 問題 | No.793 うし数列 2 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-02-25 15:51:29 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 650 bytes |
| 記録 | |
| コンパイル時間 | 534 ms |
| コンパイル使用メモリ | 72,812 KB |
| 実行使用メモリ | 9,856 KB |
| 最終ジャッジ日時 | 2026-06-01 00:41:02 |
| 合計ジャッジ時間 | 4,457 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 8 TLE * 1 -- * 12 |
ソースコード
#include <iostream>
#include <string>
using namespace std;
bool dec_str(string &N) {
// Format check should be done.
bool const positive = (N != "0");
// Decrement
if (positive) {
size_t const last_pos = N.size() - 1;
if (N[last_pos] == '0') {
size_t i = last_pos;
while (N[i] == '0') {
N[i--] = '9';
}
N[i]--;
}
else {
N[last_pos]--;
}
while (N.size() > 1 and N[0] == '0') {
N = N.substr(1);
}
}
return positive;
}
#define DIVISOR 1000000007;
int main(void) {
string N_3;
cin >> N_3;
long long num = 1;
while (dec_str(N_3)) {
num = (10 * num + 3) % DIVISOR;
}
cout << num << endl;
return 0;
}