{"id":5845,"date":"2024-08-29T19:01:01","date_gmt":"2024-08-29T11:01:01","guid":{"rendered":""},"modified":"2024-08-29T19:01:01","modified_gmt":"2024-08-29T11:01:01","slug":"\u8ba1\u7b972\u7684100\u6b21\u65b9\u6a215\u7684\u7ed3\u679c\u662f\u591a\u5c11_2\u7684\u591a\u5c11\u6b21\u65b9\u7b49\u4e8e100","status":"publish","type":"post","link":"https:\/\/mushiming.com\/5845.html","title":{"rendered":"\u8ba1\u7b972\u7684100\u6b21\u65b9\u6a215\u7684\u7ed3\u679c\u662f\u591a\u5c11_2\u7684\u591a\u5c11\u6b21\u65b9\u7b49\u4e8e100"},"content":{"rendered":"
\u76f4\u63a5\u6c42\u80af\u5b9a\u633a\u75db\u82e6\u7684\uff0c\u5229\u7528\u4e00\u4e2a\u6c42\u6a21\u7684\u7b80\u5355\u6027\u8d28\u7136\u540e\u7ed3\u5408\u9012\u5f52\u53ef\u4ee5\u5f88\u5feb\u7b97\u51fa\u3002<\/p>\n
A*B mod 5 = ( (A mod 5) * (B mod 5) ) mod 5<\/p>\n
\u8fd9\u4e2a\u6027\u8d28\u53ef\u4ee5\u7b80\u5355\u8bc1\u660e\u5982\u4e0b:<\/p>\n
\u5047\u8bbeA mod 5 = K1, B mod 5 = K2. \u90a3\u4e48\u8bbe A = 5a+K1, B = 5b + K2\u3002\u90a3\u4e48A*B = (5a+K1)*\uff085b+K2\uff09= 25ab + 5a*K2 + 5b*K1 + K1*K2,\u53f3\u8fb9\u8868\u8fbe\u5f0f\u7684\u524d\u9762\u4e09\u9879\u6a215\u7b49\u4e8e0\uff0c\u6240\u4ee5\u4e0a\u9762\u6027\u8d28\u5f97\u8bc1\u3002<\/p>\n
\u90a3\u4e48\u6211\u4eec\u53ef\u4ee5\u5229\u7528\u9012\u5f52\u7684\u65b9\u6cd5\u6765\u5c062\u7684100\u6b21\u65b9\u62c6\u62102\u768450\u6b21\u65b9\u4e58\u4ee52\u768450\u6b21\u65b9\uff0c\u7136\u540e2\u768450\u6b21\u65b9\u53c8\u53ef\u4ee5\u9012\u5f52\u7684\u7ee7\u7eed\u62c6\uff0c\u76f4\u52302\u76840\u6b21\u65b9\u6216\u80051\u6b21\u65b9\uff0c\u7a0b\u5e8f\u5982\u4e0b:<\/p>\n<\/p>\n
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication2 { class Program { static void Main(string[] args) { for (int i = 0; i < 101; ++i) { Console.WriteLine(\"{0}={1}\", i, CalculateRemain(i)); } } static int CalculateRemain(int power) { if (power == 0) { return 1; } else if (power == 1) { return 2; } else if (power % 2 == 0) { int temp = CalculateRemain(power \/ 2); return (temp * temp) % 5; } else { return (CalculateRemain(power \/ 2) * CalculateRemain(power - power \/ 2)) % 5; } } } } <\/code><\/pre>\n<\/p>\n <\/p>\n
\u5176\u4e2d\u5f53Power\u662f\u5076\u6570\u7684\u65f6\u5019\uff0c\u53ea\u8fdb\u884c\u4e00\u6b21\u9012\u5f52\u8c03\u7528\uff0c\u8fd9\u6837\u53ef\u4ee5\u907f\u514d\u5728\u4e0d\u540c\u7684\u9012\u5f52\u5206\u652f\u4e2d\u8ba1\u7b97\u76f8\u540c\u7684\u9012\u5f52\u5b9e\u4f8b\u3002 <\/p>\n","protected":false},"excerpt":{"rendered":"\u8ba1\u7b972\u7684100\u6b21\u65b9\u6a215\u7684\u7ed3\u679c\u662f\u591a\u5c11_2\u7684\u591a\u5c11\u6b21\u65b9\u7b49\u4e8e100\u76f4\u63a5\u6c42\u80af\u5b9a\u633a\u75db\u82e6\u7684\uff0c\u5229\u7528\u4e00\u4e2a\u6c42\u6a21\u7684\u7b80\u5355\u6027\u8d28\u7136\u540e\u7ed3\u5408\u9012\u5f52\u53ef\u4ee5\u5f88\u5feb\u7b97\u51fa","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"_links":{"self":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/5845"}],"collection":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/comments?post=5845"}],"version-history":[{"count":0,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/5845\/revisions"}],"wp:attachment":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/media?parent=5845"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/categories?post=5845"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/tags?post=5845"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}