{"id":748,"date":"2026-04-18T08:43:18","date_gmt":"2026-04-18T00:43:18","guid":{"rendered":"http:\/\/wordpress.fangt.online\/?p=748"},"modified":"2026-04-18T10:11:28","modified_gmt":"2026-04-18T02:11:28","slug":"p1865-a-b-problem","status":"publish","type":"post","link":"http:\/\/wordpress.fangt.online\/index.php\/2026\/04\/18\/p1865-a-b-problem\/","title":{"rendered":"P1865 A % B Problem"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u5bb9\u6613\u8d85\u65f6\uff0c\u9700\u8981\u9884\u5904\u7406\u7d20\u6570\u8868<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;bits\/stdc++.h>\nusing namespace std;\nbool isp&#91;1000005]={true,true};\nint n,m,l,r,sum&#91;1000005];\nvoid init(){\n    for(int i=2;i&lt;=1000;i++){\n        if(!isp&#91;i]){\n            for(int j=i*i;j&lt;=1000000;j+=i){\n                if(!isp&#91;j]) isp&#91;j]=true;\n            }\n        }\n    }\n    for(int i=2;i&lt;=1000000;i++){\n        if(!isp&#91;i]) sum&#91;i]=sum&#91;i-1]+1;\n        else sum&#91;i]=sum&#91;i-1];\n    }\n}\nint main(){\n    init();\n    cin>>n>>m;\n    while(n--){\n        cin>>l>>r;\n        if(l>=1&amp;&amp;l&lt;=m&amp;&amp;r>=1&amp;&amp;r&lt;=m) cout&lt;&lt;sum&#91;r]-sum&#91;l]+!isp&#91;l]&lt;&lt;endl;\n        else cout&lt;&lt;\"Crossing the line\\n\";\n    }\n    return 0;\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5bb9\u6613\u8d85\u65f6\uff0c\u9700\u8981\u9884\u5904\u7406\u7d20\u6570\u8868<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[58],"tags":[],"class_list":["post-748","post","type-post","status-publish","format-standard","hentry","category-st"],"_links":{"self":[{"href":"http:\/\/wordpress.fangt.online\/index.php\/wp-json\/wp\/v2\/posts\/748","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/wordpress.fangt.online\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/wordpress.fangt.online\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/wordpress.fangt.online\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/wordpress.fangt.online\/index.php\/wp-json\/wp\/v2\/comments?post=748"}],"version-history":[{"count":1,"href":"http:\/\/wordpress.fangt.online\/index.php\/wp-json\/wp\/v2\/posts\/748\/revisions"}],"predecessor-version":[{"id":749,"href":"http:\/\/wordpress.fangt.online\/index.php\/wp-json\/wp\/v2\/posts\/748\/revisions\/749"}],"wp:attachment":[{"href":"http:\/\/wordpress.fangt.online\/index.php\/wp-json\/wp\/v2\/media?parent=748"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/wordpress.fangt.online\/index.php\/wp-json\/wp\/v2\/categories?post=748"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/wordpress.fangt.online\/index.php\/wp-json\/wp\/v2\/tags?post=748"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}