結果

問題 No.1339 循環小数
ユーザー
提出日時 2021-01-15 21:57:40
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 750 bytes
コンパイル時間 831 ms
コンパイル使用メモリ 93,272 KB
実行使用メモリ 13,640 KB
最終ジャッジ日時 2024-11-26 14:32:21
合計ジャッジ時間 50,082 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 20 TLE * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int main() {
    int t;
    cin >> t;
    for (int i = 0; i < t; i++) {
        long long n;
        cin >> n;
        while (n % 2 == 0) {
            n /= 2;
        }
        while (n % 5 == 0) {
            n /= 5;
        }
        long long k = 9;
        for (int j = 1;; j++) {
            k %= n;
            if (k == 0) {
                cout << j << endl;
                break;
            }
            k *= 10;
            k += 9;
        }
    }
}
0