結果
| 問題 |
No.375 立方体のN等分 (1)
|
| コンテスト | |
| ユーザー |
siguma323
|
| 提出日時 | 2016-06-05 00:21:07 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,493 bytes |
| コンパイル時間 | 1,702 ms |
| コンパイル使用メモリ | 175,264 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-08 13:15:07 |
| 合計ジャッジ時間 | 2,673 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 14 WA * 18 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long;
using ll = long long;
int main()
{
ull N;
cin >> N;
ll num1 = 1;
ll num2= 1;
ll num3 = 1;
ll count = num1*num2*num3;
if(N&1)
{
map<int,int> res;
ll tmp = N;
for(ll i = 2; i*i <= tmp; ++i)
{
while(tmp % i == 0)
{
++res[i];
tmp /= i;
}
}
if(tmp != 1) res[tmp] = 1;
int index = 1;
for(auto&& x : res)
{
for(int i = 0; i < x.second; ++i)
{
if(index == 1)
{
num1 *= x.first;
index = 2;
}
else if(index == 2)
{
num2 *= x.first;
index = 3;
}
else
{
num3 *= x.first;
index = 1;
}
}
}
count = num1*num2*num3;
}
else
{
while(count != N && count < N)
{
if(num1 == num3)
++num1;
else if(num2 == num3)
++num2;
else
++num3;
count = num1*num2*num3;
}
}
if(count != N)
cout << N-1 << ' ' << N-1 << endl;
else
cout << (num1-1) + (num2-1) + (num3-1) << ' ' << N-1 << endl;
}
siguma323