結果
問題 |
No.376 立方体のN等分 (2)
|
ユーザー |
![]() |
提出日時 | 2018-04-18 16:17:22 |
言語 | C90 (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 475 bytes |
コンパイル時間 | 381 ms |
コンパイル使用メモリ | 24,064 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-27 04:30:07 |
合計ジャッジ時間 | 1,999 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 4 WA * 34 |
コンパイルメッセージ
main.c: In function ‘run’: main.c:26:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 26 | scanf("%lld",&n); | ^~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h> #include<math.h> #define MIN(a,b) ((a)<(b)?(a):(b)) typedef long long int int64; int64 calc(int64 n){ int64 min=n-1; int i,j; for(i=1;i<=cbrt(n);i++){ if(n%i!=0) continue; int t=n/i; for(j=sqrt(t);j>=i;j--){ if(t%j==0){ min=MIN(i-1+j-1+(t/j)-1,min); break; } } } return min; } void run(void){ int64 n; scanf("%lld",&n); printf("%lld %lld\n",calc(n),n-1); return; } int main(void){ run(); return 0; }