{"author_name":"nishiohirokazu","blog_url":"https://nishiohirokazu.hatenadiary.org/","provider_url":"https://hatena.blog","blog_title":"\u897f\u5c3e\u6cf0\u548c\u306e\u306f\u3066\u306a\u30c0\u30a4\u30a2\u30ea\u30fc","categories":["cpp"],"type":"rich","provider_name":"Hatena Blog","version":"1.0","author_url":"https://blog.hatena.ne.jp/nishiohirokazu/","url":"https://nishiohirokazu.hatenadiary.org/entry/20080417/1208438940","published":"2008-04-17 22:29:00","description":"\u52d5\u304b\u306a\u3044\u7406\u7531\u306f\u5f8c\u3067\u8003\u3048\u308b\u3002 class MinDifference { public: int closestElements(int A0, int X, int Y, int M, int n) { int res=10000; vector<int> a(1,A0); for(;a.size()<n;a.push_back(((a.back()*X)+Y)%M)); sort(a.begin(), a.end()); vector<int> buf; adjacent_difference(a.begin(), a.end(), buf); return buf[min_element(\u2026","image_url":null,"html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fnishiohirokazu.hatenadiary.org%2Fentry%2F20080417%2F1208438940\" title=\" - \u897f\u5c3e\u6cf0\u548c\u306e\u306f\u3066\u306a\u30c0\u30a4\u30a2\u30ea\u30fc\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","title":"","height":"190","width":"100%"}