結果

問題 No.746 7の倍数
ユーザー uw_yu1rabbit
提出日時 2020-09-07 21:00:13
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
AC  
実行時間 183 ms / 2,000 ms
コード長 827 bytes
コンパイル時間 3,446 ms
コンパイル使用メモリ 98,440 KB
最終ジャッジ日時 2025-01-14 08:13:44
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<iostream>
#include<cstdint>
#include<cstddef>
using namespace std;
using i32 = int_fast32_t;
using i64 = int_fast64_t;
using usize = uint_fast64_t;
#define rep(i, n) for (usize i = 0; i < (usize)(n); i++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using P = pair<i64,i64>;

int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
string s = "142857";
i64 n;
cin >> n;
if(n <= 6){
    if(n == 0){
        cout << 0 << endl;
        return 0;
    }
    cout << "0." << s.substr(0,n) << endl;
}else{
    i64 p = n % 6;
    i64 q = n / 6;
    string ans;
    rep(i,q){
        ans = ans + s;
    }
    if(p != 0)ans = ans + s.substr(0,p);
    ans = "0." + ans;
    cout << ans << endl;
}
}
0