結果
| 問題 |
No.375 立方体のN等分 (1)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-02-25 16:39:07 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 260 bytes |
| コンパイル時間 | 893 ms |
| コンパイル使用メモリ | 25,472 KB |
| 最終ジャッジ日時 | 2025-03-20 09:28:36 |
| 合計ジャッジ時間 | 1,415 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.c: In function 'main':
main.c:4:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
4 | scanf("%ld",&n);
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | int main(){
main.c:6:9: error: C++ style comments are not allowed in ISO C90
6 | //自明な上界
| ^
main.c:6:9: note: (this will be reported only once per input file)
main.c:9:23: warning: incompatible implicit declaration of built-in function 'sqrt' [-Wbuiltin-declaration-mismatch]
9 | for(j=sqrt(n/i)+1;j>0;j--){
| ^~~~
main.c:1:1: note: include '<math.h>' or provide a declaration of 'sqrt'
+++ |+#include <math.h>
1 | int main(){
main.c:15:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
15 | printf("%ld %ld",s,n-1);
| ^~~~~~
main.c:15:9: note: include '<stdio.h>' or provide a declaration of 'printf'
ソースコード
int main(){
long n,s,t;
int i,j;
scanf("%ld",&n);
s=n;
//自明な上界
for(i=cbrt(n)+1;i>0;i--){
if(n%i!=0)continue;
for(j=sqrt(n/i)+1;j>0;j--){
if(n/i%j!=0)continue;
t=i+j+n/i/j-3;
if(t<s)s=t;
}
}
printf("%ld %ld",s,n-1);
return 0;
}