結果

問題 No.375 立方体のN等分 (1)
ユーザー rapurasurapurasu
提出日時 2016-08-08 16:32:48
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 465 bytes
コンパイル時間 2,018 ms
コンパイル使用メモリ 158,808 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-04-24 22:10:03
合計ジャッジ時間 18,362 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,248 KB
testcase_02 AC 435 ms
5,248 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 24 ms
5,376 KB
testcase_08 AC 429 ms
5,376 KB
testcase_09 AC 6 ms
5,376 KB
testcase_10 AC 19 ms
5,376 KB
testcase_11 AC 20 ms
5,376 KB
testcase_12 AC 22 ms
5,376 KB
testcase_13 AC 19 ms
5,376 KB
testcase_14 AC 1,783 ms
5,376 KB
testcase_15 AC 58 ms
5,376 KB
testcase_16 AC 28 ms
5,376 KB
testcase_17 AC 4,450 ms
5,376 KB
testcase_18 AC 1,943 ms
5,376 KB
testcase_19 AC 29 ms
5,376 KB
testcase_20 AC 15 ms
5,376 KB
testcase_21 AC 15 ms
5,376 KB
testcase_22 TLE -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

 #include<bits/stdc++.h>
 using namespace std;
#define INF 1000000000
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
int main(){
    long long N;
    cin>>N;
    long long ans=N-1;
    for(long long i=1;i<int(sqrt(N))+1;i++){
       if(N%i!=0)continue;
       long long M=N/i;
       for(long long j=1;j<int(sqrt(N))+1;j++){
          if(M%j!=0)continue;
          long long L=M/j;
          ans=min(L+i+j-3,ans);
       }
    }
    cout<<ans<<" "<<N-1<<endl;
}
0