結果

問題 No.375 立方体のN等分 (1)
ユーザー odan3240odan3240
提出日時 2016-06-07 15:03:23
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,161 bytes
コンパイル時間 726 ms
コンパイル使用メモリ 77,400 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-17 05:40:38
合計ジャッジ時間 1,662 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

using namespace std;
using ll = long long;

#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const ll INF = 1e9;
const ll MOD = 1e9 + 7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

vector<int> f(ll N) {
    vector<int> vs;
    for (ll i = 2; i * i <= N; i++) {
        while (N % i == 0) {
            vs.push_back(i);
            N /= i;
        }
    }
    if (N != 1) vs.push_back(N);
    return vs;
}

int main() {
    ll N;
    cin >> N;
    auto vs = f(N);
    ll t[3] = {1, 1, 1};
    ll ans = 0;
    while(vs.size()) {
        auto it = vs.begin();
        rep(i, 3) {
            if(it==vs.end()) break;
            t[i]*=*it;
            it=vs.erase(it);
        }
        reverse(all(vs));
    }
    rep(i, 3) ans += t[i] - 1;
    cout << ans << " " << N - 1 << endl;
    return 0;
}
0