結果

問題 No.1339 循環小数
ユーザー yuji9511yuji9511
提出日時 2021-01-15 21:53:34
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,093 bytes
コンパイル時間 1,930 ms
コンパイル使用メモリ 199,012 KB
実行使用メモリ 7,568 KB
最終ジャッジ日時 2023-08-17 16:53:02
合計ジャッジ時間 6,012 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 13 ms
4,376 KB
testcase_12 AC 15 ms
4,376 KB
testcase_13 AC 10 ms
4,380 KB
testcase_14 AC 14 ms
4,376 KB
testcase_15 AC 13 ms
4,376 KB
testcase_16 AC 12 ms
4,376 KB
testcase_17 AC 16 ms
4,376 KB
testcase_18 AC 11 ms
4,376 KB
testcase_19 AC 10 ms
4,376 KB
testcase_20 AC 10 ms
4,380 KB
testcase_21 TLE -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

/*** author: yuji9511 ***/
#include <bits/stdc++.h>
// #include <atcoder/all>
// using namespace atcoder;
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
using vll = vector<ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
ostream& operator<<(ostream& os, lpair& h){ os << "(" << h.first << ", " << h.second << ")"; return os;}
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}

void solve(){
    ll N;
    cin >> N;
    ll M = N;
    while(M % 2 == 0) M /= 2;
    while(M % 5 == 0) M /= 5;
    if(M == 1){
        print(1);
        return;
    }
    ll x = 1, cur = 1;
    while(true){
        cur *= 10;
        cur %= M;
        if(cur == 1){
            print(x);
            return;
        }
        x++;
    }

}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll t;
    cin >> t;
    while(t--) solve();
}
0