結果
| 問題 |
No.413 +5,000,000pts
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-06-06 16:33:39 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 516 bytes |
| コンパイル時間 | 542 ms |
| コンパイル使用メモリ | 51,804 KB |
| 最終ジャッジ日時 | 2024-11-14 19:45:05 |
| 合計ジャッジ時間 | 1,048 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function ‘ll calc(ll)’:
main.cpp:7:21: error: ‘sqrt’ was not declared in this scope
7 | return (ll)((-1 + sqrt(1 + 4*d)) / 2.0);
| ^~~~
main.cpp: In function ‘ll correct(ll)’:
main.cpp:11:21: error: ‘sqrt’ was not declared in this scope
11 | return (ll)((-1 + sqrt(1+4*(long double)d)) / 2.0);
| ^~~~
main.cpp: In function ‘int main()’:
main.cpp:15:27: error: ‘pow’ was not declared in this scope
15 | const ll MAX_VALUE = ll(pow(10, 18));
| ^~~
ソースコード
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
ll calc(ll d) {
return (ll)((-1 + sqrt(1 + 4*d)) / 2.0);
}
ll correct(ll d) {
return (ll)((-1 + sqrt(1+4*(long double)d)) / 2.0);
}
int main(void) {
const ll MAX_VALUE = ll(pow(10, 18));
const int N = 100000;
for(ll k=82345678LL, cnt=0; cnt<N; ++k) {
ll d = k*k + k - 1;
if(!(1 <= d && d <= MAX_VALUE)) { continue; }
if(calc(d) != correct(d)) {
++cnt;
cout << d << endl;
}
}
return 0;
}