結果

問題 No.428 小数から逃げる夢
ユーザー hiyokko2
提出日時 2017-08-16 09:40:32
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 648 bytes
コンパイル時間 1,211 ms
コンパイル使用メモリ 161,120 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-13 12:49:35
合計ジャッジ時間 3,475 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 100
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define FOR(i,bg,ed) for(ll i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
//#define int long long
using namespace std;
typedef long long ll;
const int INF = 1e9;



signed main()
{
    int N;
    string D = "";

    cin >> N;
    for (int i=1; i<=99; i++) {
        D += to_string(i);
    }
    D += "1";

    string ans = "";
    int carry = 0;
    for (int i=D.length()-1; i>=0; i--) {
        int keta = D[i] - '0';
        keta *= N;
        carry += keta;
        ans = to_string(carry % 10) + ans;
        carry /= 10;
    }

    ans = to_string(carry) + "." + ans;
    cout << ans << endl;
}
0