結果
| 問題 |
No.375 立方体のN等分 (1)
|
| コンテスト | |
| ユーザー |
sugarrr
|
| 提出日時 | 2018-07-23 00:40:02 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 109 ms / 5,000 ms |
| コード長 | 991 bytes |
| コンパイル時間 | 750 ms |
| コンパイル使用メモリ | 77,828 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-26 05:28:09 |
| 合計ジャッジ時間 | 2,293 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 32 |
ソースコード
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<bitset>
using namespace std;
typedef long long ll;
#define i_7 1000000007
#define i_5 1000000005
ll mod(ll a){
ll c=a%i_7;
if(c>=0)return c;
else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=1000000000000;/*10^12*/
#define rep(i,l,r) for(ll i=l;i<=r;i++)
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
//////////////////////////////////////
int main(){
ll n;cin>>n;
ll ans=n-1;
for(ll a=1;a*a*a<=n;a++){
if(n%a!=0)continue;
for(ll b=a;a*b*b<=n;b++){
if(n%b==0){
if(n%(a*b)==0){
ans=min(a+b+n/a/b-3,ans);
}
}
}
}
cout<<ans<<" "<<n-1<<endl;
return 0;
}
sugarrr