結果

問題 No.375 立方体のN等分 (1)
コンテスト
ユーザー taba
提出日時 2017-05-19 22:44:31
言語 C++17
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 632 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,295 ms
コンパイル使用メモリ 155,508 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-06-06 16:47:36
合計ジャッジ時間 3,068 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 13 WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <random>
#include <vector>
#include <algorithm>
#include <array>
#include <functional>
#include <utility>
#include <regex>
#include <tuple>
#include <map>
#include <set>
#include <iostream>

using namespace std;

int main(){
	int64_t n,t;
	-scanf("%ld",&n);
	t=n;
	int64_t a,b,c,nr3=pow(n,1.f/3)+1,minabc=n;
	for(a=1;a<nr3;a++){
		int64_t na=n%a;
		if(na)continue;
		int64_t nr2=sqrt(n/a)+1;
		for(b=1;b<nr2;b++){
			int64_t nb=n%b;
			if(nb)continue;
			c=n/a/b;
			minabc=min(minabc,a+b+c-3);
		}
		
	}
	printf("%ld %ld\n",minabc,n-1);
	return 0;
}
0