結果
| 問題 |
No.375 立方体のN等分 (1)
|
| コンテスト | |
| ユーザー |
ixmel
|
| 提出日時 | 2016-07-10 14:54:33 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 141 ms / 5,000 ms |
| コード長 | 973 bytes |
| コンパイル時間 | 867 ms |
| コンパイル使用メモリ | 82,476 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-13 10:14:22 |
| 合計ジャッジ時間 | 2,102 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 32 |
ソースコード
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const ll inf=1e17;
int main(){
ll in;
cin>>in;
ll out=inf;
for(ll i=1;i*i<=in;i++)if(in%(i+1)==0){
ll t=in/(i+1);
out=min(out,i+t-1);
for(ll j=1;j*j<=t;j++)if(t%(j+1)==0){
out=min(out,i+j+t/(j+1)-1);
}
}
if(out==inf)out=in-1;
cout<<out<<" "<<in-1<<endl;
}
ixmel