結果
| 問題 |
No.1042 愚直大学
|
| コンテスト | |
| ユーザー |
c-yan
|
| 提出日時 | 2020-05-02 12:42:35 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 366 bytes |
| コンパイル時間 | 154 ms |
| コンパイル使用メモリ | 24,192 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-26 03:15:03 |
| 合計ジャッジ時間 | 1,071 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 23 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:6:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | scanf("%d", &P);
| ^~~~~~~~~~~~~~~
main.c:7:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%d", &Q);
| ^~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
#include <math.h>
int main() {
int P, Q;
scanf("%d", &P);
scanf("%d", &Q);
double ok = 1.0, ng = 1e12;
for (int i = 0; i < 60; i++) {
double N = (ok + ng) / 2;
if (N * N <= Q * log2(N) * N + P) {
ok = N;
} else {
ng = N;
}
}
printf("%f\n", ok);
return 0;
}
c-yan