結果
問題 | No.375 立方体のN等分 (1) |
ユーザー |
|
提出日時 | 2018-07-08 07:28:33 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 127 ms / 5,000 ms |
コード長 | 312 bytes |
コンパイル時間 | 487 ms |
コンパイル使用メモリ | 64,836 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-06 14:10:22 |
合計ジャッジ時間 | 1,791 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 32 |
コンパイルメッセージ
main.cpp:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 4 | main() | ^~~~
ソースコード
#include<iostream> using namespace std; long n; main() { cin>>n; long ans=n-1; for(long i=2;i*i<=n;i++) { if(n%i<1) { long m=n/i; for(long j=1;j*j<=m;j++) { if(m%j<1) { long k=m/j; long cnt=i-1+j-1+k-1; ans=ans<cnt?ans:cnt; } } } } cout<<ans<<" "<<n-1<<endl; }