{"type":"rich","categories":["\u65e5\u8a18","Haskell"],"published":"2009-07-16 23:58:48","height":"190","blog_title":"\u843d\u66f8\u304d\u3001\u6642\u3005\u843d\u5b66","url":"https://jeneshicc.hatenadiary.org/entry/20090716/1247756328","image_url":null,"author_name":"jeneshicc","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fjeneshicc.hatenadiary.org%2Fentry%2F20090716%2F1247756328\" title=\"\u9023\u7acb\u5408\u540c\u65b9\u7a0b\u5f0f - \u843d\u66f8\u304d\u3001\u6642\u3005\u843d\u5b66\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","version":"1.0","author_url":"https://blog.hatena.ne.jp/jeneshicc/","provider_url":"https://hatena.blog","blog_url":"https://jeneshicc.hatenadiary.org/","title":"\u9023\u7acb\u5408\u540c\u65b9\u7a0b\u5f0f","description":"\u3061\u3087\u3063\u3068\uff0c\u9023\u7acb\u5408\u540c\u65b9\u7a0b\u5f0f\u3092\u89e3\u304f\u5fc5\u8981\u304c\u3067\u3066\u304d\u305f\u306e\u3067\uff0c\u5b9f\u88c5\u3057\u3066\u307f\u305f\uff0e \u3053\u3053\u3067\uff0cinvMod n p = n^(-1) (mod p)\uff0e -- Input: \u4e92\u3044\u306b\u7d20\u306a\u6574\u6570 m1,m2,...,mn, \u6574\u6570 a1,a2,...,an -- Output: \u9023\u7acb\u5408\u540c\u65b9\u7a0b\u5f0f\u306e\u89e3 x in Zm s.t. x = ai (mod mi) congruence :: (Integral a) => [a] -> [a] -> a congruence ms as = (`mod` m).sum.zipWith3 add as vs $ us where m = product ms us = [div m \u2026","width":"100%","provider_name":"Hatena Blog"}