エントリーの編集は全ユーザーに共通の機能です。
必ずガイドラインを一読の上ご利用ください。
ここにツイート内容が記載されます https://b.hatena.ne.jp/URLはspanで囲んでください
Twitterで共有ONにすると、次回以降このダイアログを飛ばしてTwitterに遷移します
注目コメント算出アルゴリズムの一部にLINEヤフー株式会社の「建設的コメント順位付けモデルAPI」を使用しています
# include <iostream> # include <vector> # include <algorithm> using namespace std; int main() { s... # include <iostream> # include <vector> # include <algorithm> using namespace std; int main() { std::vector<float> v; for (int i = 0; i < 10; ++i) v.push_back(i); float val = 11; int back = std::lower_bound(v.begin() + 1, v.end() - 1, val) - v.begin(); int front = back - 1; float x = v[front] - val; float y = v[back] - val; int near; if (x * x < y * y) near = front; else near = back; cout << v[nea