結果
問題 | No.375 立方体のN等分 (1) |
ユーザー |
|
提出日時 | 2016-06-04 23:27:43 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 108 ms / 5,000 ms |
コード長 | 583 bytes |
コンパイル時間 | 528 ms |
コンパイル使用メモリ | 63,360 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-11 20:49:34 |
合計ジャッジ時間 | 2,064 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 32 |
ソースコード
#include <iostream>#include <climits>using namespace std;typedef long long ll;int main(void){// Here your code !ll N;ll mi = LLONG_MAX;cin >> N;for(ll a=1;a*a*a<=N;a++){if(N%a!=0){continue;}ll M = N/a;for(ll b=1;b*b<=M;b++){if(M%b!=0){continue;}ll c = M/b;ll total = (a-1)+(b-1)+(c-1);if(total < mi){mi = total;}}}cout << mi << " " << N-1 << endl;return 0;}