Lookas2001 Https://lookas2001.com Lookas2001's small station Fri, 02 Aug 2019 14:46:29 +0000 Zh-CN Hourly One Https://wordpress.org/? V=5.2.2 Https://lookas2001.com/wp-content/uploads/2017/10/cropped-icon-32x32.jpg Lookas2001 Https://lookas2001.com Thirty-two Thirty-two One hundred and sixty-four million five hundred and sixty thousand six hundred and two OpenWrt uses its own Dnsmasq shield website (set parsing). Https://lookas2001.com/openwrt-%e4%bd%bf%e7%94%a8%e8%87%aa%e5%b8%a6%e7%9a%84-dnsmasq-%e5%b1%8f%e8%94%bd%e7%bd%91%e7%ab%99%ef%bc%88%e8%ae%be%e7%bd%ae%e8%a7%a3%e6%9e%90%ef%bc%89/ Https://lookas2001.com/openwrt-%e4%bd%bf%e7%94%a8%e8%87%aa%e5%b8%a6%e7%9a%84-dnsmasq-%e5%b1%8f%e8%94%bd%e7%bd%91%e7%ab%99%ef%bc%88%e8%ae%be%e7%bd%ae%e8%a7%a3%e6%9e%90%ef%bc%89/#respond Fri, 02 Aug 2019 14:46:29 +0000 Https://lookas2001.com/? P=430 Continue reading "OpenWrt uses its own Dnsmasq shielding web site (set parsing)".

> >
Sometimes, we may want to shield a website (for example, screen millet ads) or set up a parse for a specific website (for example, testing locally before publishing its website). OpenWrt provides a powerful analytical tool Dnsmasq, which is much more powerful than the local Host. Compared with local Host, he supports compatibility and can analyze special types of records.

There are tutorials on the Internet, you need to install Adblock or something, but it is actually a line (exactly three lines) command (Luci does not provide modified location, so it can not be solved on the web page).

 The example.com domain name a type is set up as
uci add_list dhcp.@dnsmasq[0].address= "/example.com/".


> >
Https://lookas2001.com/425-2/ Https://lookas2001.com/425-2/#respond Thu, 01 Aug 2019 16:47:24 +0000 Https://lookas2001.com/? P=425 Continue reading "

> >
Mojang attached a PDB debug symbol file while publishing bedrock_server.

The point is that the document is quite large. The whole terminal is 100MB, the debug file 60MB.

However, I feel that Mojang is doing this on purpose. Minecraft is a commercial software that can not generate source code, but Minecraft needs the community to do plug-ins, and Mojang is too lazy to do API.

Then I'll debug the files for you, and you can decompile it yourself.


> >
Https://lookas2001.com/425-2/feed/ Zero Four hundred and twenty-five
Minecraft Sponge server Universal Market plugin trample record and repair Sinicization version download Https://lookas2001.com/minecraft-sponge-%e6%9c%8d%e5%8a%a1%e7%ab%af-universal-market-%e6%8f%92%e4%bb%b6%e8%b8%a9%e5%9d%91%e8%ae%b0%e5%bd%95%e5%8f%8a%e4%bf%ae%e5%a4%8d%e6%b1%89%e5%8c%96%e7%89%88%e6%9c%ac%e4%b8%8b%e8%bd%bd/ Https://lookas2001.com/minecraft-sponge-%e6%9c%8d%e5%8a%a1%e7%ab%af-universal-market-%e6%8f%92%e4%bb%b6%e8%b8%a9%e5%9d%91%e8%ae%b0%e5%bd%95%e5%8f%8a%e4%bf%ae%e5%a4%8d%e6%b1%89%e5%8c%96%e7%89%88%e6%9c%ac%e4%b8%8b%e8%bd%bd/#respond Fri, 28 Jun 2019 04:26:45 +0000 Https://lookas2001.com/? P=330 Continue reading "Minecraft Sponge server side Universal Market plugin trample record and repair Sinicization version download"

> >
Minecraft was bored with the original version. (the dragon has finally played.) I want to play Minecraft MOD, so I installed the 2 module of industry. I was thinking about online, and I had been looking for mcbbs for a long time. If you play too lonely, then build a suit. This is a preface, not a lot of details. In general, there are many pits, but fortunately, there are tutors from predecessors (such as http://www.mcbbs.net/thread-786074-1-1.html). In line with the spirit of serving the people, choose a pit here and summarize the process to help later friends.

Brief introduction

Universal Market is a consignment market with a box like interface.

MCBBS reprint stickers: Http://www.mcbbs.net/thread-792152-1-1.html
Github original project: Https://github.com/Xwaffle1/UniversalMarket


20190628 update: fix the problem of hot loading no matter, repair empty handed to add bug to the market.



Because the various hints of the project are built into the code, the Sinicization needs to be recompiled, and there are source code files on it. If you don't feel comfortable, you can manually compile them according to the compilation process below. Chinese translation is provided by Tollainmear.

Problems arise

The server version I build is Minecraft 1.12.2, Forge 1.12.2-, SpongeForge 1.12.2-2825-7.1.6. After installing the 1.3 version of the Universal Market plugin (https://github.com/Xwaffle1/UniversalMarket/releases/tag/1.3), it was found that it was not possible to enter the store. The console reported the following error:

 [xx:xx:xx] [Server thread/ERROR] [Sponge]: Error occurred while executing command'um'for for, command, command,'um', for, command, command,'um', for, command, command,'um', for, command, command,'um', for, command, command,'um', for, etc. 340) ~[SimpleDispatcher.class:1.12.2-2825-7.1.6]
at org.spongepowered.common.command.SpongeCommandManager.process (SpongeCommandManager.java:337) [SpongeCommandManager.class:1.12.2-2825-7.1.6]
at net.minecraft.command.ServerCommandManager.func_71556_a (SourceFile:1156) [dh.class:?]
at net.minecraft.network.NetHandlerPlayServer.func_147361_d (NetHandlerPlayServer.java:960) [pa.class:?? L$1.run (SourceFile:13) [hv$1.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:511) [?: 1.8.0_74]
at java.util.concurrent.FutureTask.run (FutureTask.java:266) [1.8.0_74]
at: net.minecraft.util.Util.func_181617_a (FutureTask.java:266)]?

I was a little nervous at that time, because I had not contacted Java systematically before. I only learned a little bit about the ESS/SMP Product Authorization test and Moegirl Android App.

Location and solution

Go directly to search engine.

Because this project is open source. (Open Source great law!) We can download the code and study it slowly.

Later, I looked for issue in the original project to find the https://github.com/Xwaffle1/UniversalMarket/issues/20. In some ways, I contacted a Dalao Alone that had finished patching the previous version of jar, and thanked my works for opening my hair when I had no idea.

Fortunately, with trace, we can see that the last error on this plug-in occurred. Com.xwaffle.universalmarket.utils.ItemBuilder. (ItemBuilder.java:38) ~[ItemBuilder.class:?] Here:

We throw the setRawData function onto Sponge Forum to search https://forums.spongepowered.org/t/set-get-modify-subid-of-itemstack/19048/9 and find that this function is related to setting some attributes on the item, which is a comparison of Hacky.

Search for the function corresponding to this code in the project:

It is found that this code is only related to the Market.java file, and opens to find the calling place.

We found that the invocation point set up by UnsafeDamage through the meta variable is only here:

After loading the good plug-in, you can see that this is the confirmation button for the payment confirmation interface.

Presumably, this may be a function similar to the progress bar that the author wants to do, but in the end it may end up muttering (for human nature) for various reasons.

Then remove this line and the related two lines (that is, the top two lines of the bug line).

Stumbling block - compile

Minecraft uses Java 8 as its running environment. Accordingly, the Mod development around it is based on Java 8, and recommends the use of Java 8 to carry out the following work.

My local computer is MacBook development environment for MacOS, relative to Windows system, more powerful in the command line, the surrounding facilities are also more. Personal development, usually using brew as a package management, installation software quickly and quickly. But Brew does not provide Java 8 by default (presumably out of date). And downloading on Oracle's official website is impossible. (download also needs to login). There is such an answer to https://stackoverflow.com/a/55774255 on StackOverflow, which solves the problem of Java 8 installation.

See that this project uses gradle as its dependency management (or build tool?) According to my previous experience of using composer and NPM, I think that brew should be installed. As a matter of fact, it is unnecessary. The gradle version on brew is too high, and the project itself provides a package management command, that is, gradlew. Running will generate corresponding files in the project catalog and user directory.

So ./gradlew Once, after downloading the necessary files, I gave a hint. According to this hint, I should run. ./gradlew tasks Run, find the options that seem to be built. ./gradlew build Running, stupid, prompt error:

/xxxxxx/UniversalMarket-master/build/sources/main/java/com/xwaffle/universalmarket/market/Market.java:30: error: there is no 
import org.spongepowered.common.item.inventory.adapter.impl.slots.SlotAdapter in package org.spongepowered.common.item.inventory.adapter.impl.slots; 
/xxxxxx/UniversalMarket-master/build/sources/main/java/com/xwaffle/universalmarket/market/Market.java:31: error: there is no 
import org.spongepowered.common.item.inventory.query.operation.InventoryPropertyQueryOperation in package org.spongepowered.common.item.inventory.query.operation; 
/xxxxxx/UniversalMarket-master/build/sources/main/java/com/xwaffle/universalmarket/market/Market.java:32: error: there is no 
import org.spongepowered.common.item.inventory.util in package org.spongepowered.common.item.inventory.util; Er/build/sources/main/java/com/xwaffle/universalmarket/market/MarketItem.java:10: error: there is no 
import org.spongepowered.common.item.inventory.util.ItemStackUtil in the package org.spongepowered.common.item.inventory.util; 
/xxxxxx/UniversalMarket-master/ build/sources/main/java/com/xwaffle/universalmarket/utils/ItemBuilder.java:11: error: there is no 
import org.spongepowered.common.item.inventory.util.ItemStackUtil in the org.spongepowered.common.item.inventory.util of the package; ^ ^ note: Writing plugin, plugin, error in the wrong way.

Search for Sponge documents, and see that the examples given by the authorities are all based on IDE. However, because of insufficient MacBook space, I installed Intellij IDEA Community on another computer (Windows), and then used the build button provided by IDE for a long time to download. Finally, I hint at two errors, "PKIX path building building" and "mtv".

In the previous step, I observed one thing, why there was no other problem in the introduction, and these problems were introduced. I found that these packages started with org.spongepowered.common.xxxx. I saw the build.gradle file before, obviously passed. Compile'org.spongepowered:spongeapi:7.0.0' Introduce SpongeAPI. After the investigation of IDE, I decided to see what the Java compiler was introducing.

Because of previous gradle related experience, I know that gradle will generate folders in user directories. ~/.gradle Go and search it. Find. Grep sponge There is one of the search results. ./caches/modules-2/files-2.1/org.spongepowered/spongeapi/7.0.0/ada1f9981de3459b182ee16d6408173ef33a8943/spongeapi-7.0.0.jar This is the package corresponding to API.

Decompress (no decompile):

Self closing

Where does common come from?!

Back to build.gradle, look down one line. Compile files ('libs/spongeforge-1.12.2-2555-7.1.0-BETA-2837.jar') In conjunction with the description of the SpongeCommon project, the author TM directly relies on the release version of SpongeForge. And the source code has deleted this directory!!! Combined with the use of API, Sponge does not recommend plug-in writers to bypass Sponge and other behaviors, which is directly introduced by the plugin author. Net.minecraft.nbt.NBTTagCompound No wonder the author did not issue MOD on the Ore (probably not related to Sponge's API).

Download the latest stable version of SpongeForge (spongeforge-1.12.2-2825-7.1.6.jar) (old does not want to turn over), create LIBS directory to throw in. Then modify the corresponding filename in build.gradle (keep matching). Run again. ./gradlew build

Finally, baby, I see you.

Finally, the test is perfect.

> >
Share files on WebDAV on OpenWrt Https://lookas2001.com/openwrt-%e4%b8%8a%e9%80%9a%e8%bf%87-webdav-%e5%85%b1%e4%ba%ab%e6%96%87%e4%bb%b6/ Https://lookas2001.com/openwrt-%e4%b8%8a%e9%80%9a%e8%bf%87-webdav-%e5%85%b1%e4%ba%ab%e6%96%87%e4%bb%b6/#comments Sat, 11 May 2019 09:16:12 +0000 Https://lookas2001.com/? P=321 Continue reading "Share files on WebDAV on OpenWrt"

> >

Lookas2001 copyright, this work is licensed under the knowledge sharing signature 4 international license agreement. Please indicate the author and source when reusing.

OpenWrt (https://openwrt.org/) is a very powerful router firmware, and many functions can be achieved by installing software packages. WebDAV (http://www.webdav.org/) is an extension to HTTP, which can be used to share files. So we can try to install the corresponding software package on OpenWrt and let the device support WebDAV.

Compared to SMB, AFP, in actual testing, the speed of WebDAV is more dominant. This may benefit from the fact that WebDAV is based on HTTP, and the HTTP server may have some black technology to increase speed when reducing occupancy (or possibly because WebDAV in the next step is based on HTTP instead of HTTPS).

Another reason for writing this article is that SMB and AFP already have relatively complete tutorials, such as these two articles, https://openwrt.org/docs/guide-user/services/nas/samba_configuration https://openwrt.org/docs/guide-user/services/nas/netatalk_configuration, but WebDAV lacks documentation.

Lighttpd (https://www.lighttpd.net/) is a lightweight, yet fully functional HTTP server. It is observed that he provides WebDAV mod, so it can be used to implement WebDAV server.

Install Lighttpd and WebDAV Auth module

before Opkg update To update the local package information.

adopt Opkg install lighttpd lighttpd-mod-webdav lighttpd-mod-auth lighttpd-mod-authn_file You can install the key packages that you rely on.

If the download speed is slow or download is difficult, you can manually download the corresponding package on http://downloads.openwrt.org, install it, or set up a network agent (this is not the scope of this article, you need to find your own way).

Configure Lighttpd

Unlike SMB, which provides UCI unified configuration interface, Lighttpd needs to be modified under /etc/lighttpd.

adopt VI /etc/lighttpd/lighttpd.conf Open the main configuration file of lighttpd.

May pass CP /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.bak Set up a backup to restore when configuration is wrong.

This is a configured configuration file:

 /mnt "
server.upload-dirs = (" /tmp ") 
server.errorlog =" /var/log/lighttpd/error.log "
server.pid-file =" /var/run/lighttpd.pid "
server.username =" HTTP "= =" (")", "=" "," "("), "(") "," (")", "(") "," (")", "(") "," (")," (")", "(") "," (")", "(") "," (")", "(") "," (")", "(") "," (")", "(") "," (")", "(") "," (")", "(") "," (")", "(") "," (")", "(") "," (")", "(") "," (")", "(") "," (")", "(") "," (")", "(") "," (")", "(") "," (")", "(") "," (")", "(") "," (")", "(") "," (")", "=", "=", "=", "=", "=", "=", "=", "=", "=", "=", "=", "=", "," = "," = "," = "," = "," = "," = "," = "," (")", "(") "," (")", "(") "," (")", "(") "," (")", "(") "," (")", "("), "(") "," (")", "(") "," (")", "server.document-root ="

The annotation in the lighttpd configuration file is implemented by adding "a" in front of the line.

Here are some changes.

Server.document-root = "/mnt" The document root is set to /mnt I added two hard disks to the router, which are mounted on /mnt/sda1 and /mnt/sdb1 respectively. This storage location is not fixed and can be adjusted according to your own preferences.

Server.port = 81 That is, the port we used to access later, the 80 port has been occupied by the uHTTPd with the system, and another conflict prevention is set up here.

Server.errorlog-use-syslog = "enable" This option can output the error log to syslog, so that we can see the error in the web console.

Server.dir-listing = "enable" , Dir-listing.encoding = "UTF-8" These two options enable you to enable listing of file functions and prevent file name garbled.

Configure WebDAV module

adopt VI /etc/lighttpd/conf.d/30-webdav.conf Open the main configuration file of lighttpd.

This is a configured configuration file:

##  WebDAV Module
## See https://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ModWebDAV
server.modules += ( "mod_webdav" )

  ## enable webdav for this location
  webdav.activate = "enable"

  ## By default the webdav url is writable.
  ## Uncomment the following line if you want to make it readonly.
  webdav.is-readonly = "enable"

  ## Log the XML Request bodies for debugging
  #webdav.log-xml = "disable"

  webdav.sqlite-db-name = "/tmp/lighttpd-webdav.db"

Here are some changes.

Notes have been dropped. $HTTP["URL"] = = "^/dav ($/") { , } The two line, the purpose of installing Lighttpd here is to WebDAV, and annotate these two rows to set the whole website to WebDAV.

Webdav.activate = "enable" WebDAV has been enabled for the entire site.

Webdav.is-readonly = "enable" Set the operation mode in read-only mode. Set up here. Disable You can disable read-only (readable, readable).

"/mnt/sda1/.lighttpd-webdav.db" Here, we need to set up a database storage location for the WebDAV module. The location is recommended to be selected on the hard disk. This database file needs to store some attributes besides locking, if it is stored in places that are easy to lose. /tmp It will lead to data loss. Storage in addition to the location outside the hard disk will shorten the lifetime of flash memory (flash erasure upper limit). Please note that Lighttpd needs to write permission to store location directory. Chmod a+w XXX To grant permission.


  • Contents of OpenWrt forum https://forum.openwrt.org/t/webdav-configuration-essense-with-lighttpd-on-openwrt/25357
  • Document https://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_ModWebDAV provided by Lighttpd

Configure Auth module

This configuration is used to enhance the security of your files, but it is not necessary, and the configuration can only enhance a little security. Attackers can still intercept passwords halfway. If you want to better enhance the security, please configure HTTPS.

adopt VI /etc/lighttpd/conf.d/20-auth.conf Open the main configuration file of lighttpd.

This is a configured configuration file:

##  Authentication Module
## See https://redmine.lighttpd.net/projects/lighttpd/wiki/docs_modauth
## for more info.
server.modules += ( "mod_auth" )

auth.backend                 = "plain"
auth.backend.plain.userfile  = "/etc/lighttpd/lighttpd.user"
#auth.backend.plain.groupfile = "/etc/lighttpd/lighttpd.group"

#auth.backend.ldap.hostname = "localhost"
#auth.backend.ldap.base-dn  = "dc=my-domain,dc=com"
#auth.backend.ldap.filter   = "(uid=$)"

auth.require               = ( "/" =>
                                 "method"  => "basic",
                                 "realm"   => "Personal File Server",
                                 "require" => "valid-user"


Here are some changes.

It may be the carelessness of the baling personnel. There is no original configuration file. Server.modules + = ("mod_auth") One line, in order to enable this module, must be manually added.

Auth.backend = "plain" Set the authentication backend to Plain

Auth.backend.plain.userfile = "/etc/lighttpd/lighttpd.user" Set the location of authenticated backend to store authentication information.

Auth.require =... To cancel the annotation here means that authentication is enabled.

"/" This is the total station.

"Method" = > "basic" The type of authentication is set to Basic For better client compatibility.

"Realm" = > "Personal File Server". That is, when prompted, the message can be set at random.

adopt Touch /etc/lighttpd/lighttpd.user We can create the authentication information file we need.

adopt VI /etc/lighttpd/lighttpd.user Edit and authenticated information file.

This is a sample:


See user name and password. : Separated, separated by empty lines between multiple users.


  • Document https://redmine.lighttpd.net/projects/lighttpd/wiki/docs_modauth provided by Lighttpd
> >
Min_25 sift learning notes (pseudo) Https://lookas2001.com/min_25-%e7%ad%9b%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b0/ Https://lookas2001.com/min_25-%e7%ad%9b%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b0/#respond Tue, 08 Jan 2019 11:32:59 +0000 Https://lookas2001.com/? P=315 Continue reading "Min_25 sift learning notes (pseudo)"

> >
Recommended blog: https://blog.csdn.net/qq_33229466/article/details/79679027

Below, the understanding of some corners and corners.

By factoring all the numbers into factoring factors, we consider that the number is classified according to the first prime factor and its number (p^e). We find that the sum of this class can extract a f (p^e) by the nature of the product function, that is, the formula will become f (p^e) (f (a_1 / p^e) + F (a_2 / p^e) +... ) It can be found that the latter part of the formula is a very similar problem. This is probably the main idea of Min_25 sieves.

Specifically, two summation functions are defined. One summation function (h in Zhu Zhenting's paper and G on most blogs on the Internet) assists another evaluation function (that is, G in G papers, and S in most blogs on the Internet).

The evaluation process of the auxiliary evaluation function is very similar to the process of the Ehrlich sieve, so this method is also called the extended Ehrlich sieve method.

Space use only needs O (\sqrt n), because each recursive form is like (all is the division of downward rounding) n - > n / I, N / I - > n / I / J, and the RGP / g / V can be equivalent to (/ *). Number theory is divided into blocks.

What is the complexity of Zhu Zhenting's thesis?

Here are some mathematical formulas (which should be without pots). The code directly sets those formulas. The template is in Counting Divisors.

Product function: $f (x) $

$f (p^e) = \sum_k a_k (E) p^k$is required.

Auxiliary summation function: $h_k (n, J) = \sum_{2 \leq I \leq N and (I's least prime factor > p_j or I is prime number)}

If $p_j > \sqrt n$, there is $h_k (n, J) = h_k (n, J - 1) $;

Otherwise, there is $h_k (n, J) = h_k (n, J - 1) - p_j^k (h_k (\lfloor \frac n{p_j}\rfloor, j 1) - ((- 1 - 1 -)) $.

In particular, for $j = 0$, there is $h_k (n, J) = \sum_{2 \leq I \leq n} i^k$.

In short, $h_k (n) = h_k (n, J) $, where $p_j > \sqrt n$(that is, the auxiliary summation function we want finally does not have a combined number).

Summation function: $g (n, m) = \sum_{2 \leq I \leq N and (I's least prime factor > p_m)} f (f) $

It can be seen that $g (n, m) = \sum_k a_k (1) (H (n) - H (p_m)) + \sum_{p_m < p_j\leq + 1, and + + (+).

If $p_0$is spoken, it will be fine when $0$is processed.

$g (n, 0) $is the requirement.


typedef unsigned long long u64;

const int MAX_SQRT_N = 1e5;

struct euler_sieve {
    static const int MAX_N = MAX_SQRT_N;
    bool f[MAX_N + 10];
    int p[MAX_N + 10];
    int p_n;

    inline void operator()(int n) {
        memset(f, 0, sizeof f);
        p_n = 0;
            if (!f[i]) {
                p[++p_n] = i;
            for (int j = 1; p[j] * i <= n; ++j) {
                f[p[j] * i] = true;
                if (i % p[j] == 0) break;
} es;

struct Min_25_sieve {
    u64 n;

    u64 b[2 * MAX_SQRT_N + 10]; // 所有可能的 n / i 值，值是从大到小的（废话）
    int b_n, sqrt_n;
    inline int locate(u64 i) { return i < sqrt_n ? b_n - i + 1 : n / i; } // 查找 b[j] == i 的位置 j 

    int d0[2 * MAX_SQRT_N + 10]; // 存储 h 函数的值，数组命名个人癖好而已。  The value of the H function is only O (\sqrt n). The location at I is not h (I), but h (b[i]) 
inline void pre_calc () {/ / compute h function 
for (int = 1; I) = = 1; * = (* 1); / / ((0)). 这里以及下面的 1 * 代表的就是 i^k （本题中 k = 0（不是输入的那个 k 啊））
        for (int j = 1; (u64)es.p[j] * es.p[j] <= n; ++j) { // 枚举质数
            for (int i = 1; (u64)es.p[j] * es.p[j] <= b[i]; ++i) { // 枚举了有用的，即 b[i] 
                d0[i] = d0[i] - 1 * (d0[locate(b[i] / es.p[j])] - d0[locate(es.p[j] - 1)]); // 一定有 p[j] - 1 < \sqrt n ，所以一定可以找到一个合法的位置（不会落在一个段内） // 由于 b[i] 的值是从大道小的，所以求值顺序是没有问题的，不用开另外一个缓存数组

    u64 f_a0_k;
    inline u64 f_a0(int e) { return e * f_a0_k + 1; }
    inline u64 f(int p, int e) { return f_a0(e); }

    u64 calc(u64 n, int m) { // 计算 g 函数
        u64 rst = f_a0(1) * (d0[locate(n)] - d0[locate(es.p[m])]);
        for (int j = m + 1; (u64)es.p[j] * es.p[j] <= n; ++j) {
            u64 pe = es.p[j];
            for (int e = 1; (u64)pe * es.p[j] <= n; ++e, pe *= es .p[j]) {
                rst += f(es.p[j], e) * calc(n / pe, j) + f(es.p[j], e + 1);
        return rst;

    inline u64 operator()(u64 n_, u64 f_a0_k_) {
        n = n_;
        f_a0_k = f_a0_k_;

        // 分块
        sqrt_n = 0; while ((u64)sqrt_n * sqrt_n < n) ++sqrt_n;
        b_n = 0; for (u64 i = 1; i <= n; i = n / (n / i) + 1) b[++b_n] = n / i;

        // 处理辅助求和函数

        // 求和
        es.p[0] = 0, d0[b_n + 1] = 0;
        return calc(n, 0) + 1; // + 1 是那个甩单的 1 
} mns;

int main() {
    // freopen("in.in", "r", stdin);

    int tc; scanf("%d", &tc);
    // int tc = 1;
    es(MAX_SQRT_N + 5); // 筛出质数
    while (tc--) {
        u64 n, f_a0_k; scanf("%llu%llu", &n, &f_a0_k);
        printf("%llu\n", mns(n, f_a0_k));

    return 0;
> >
It's coming to an end. Https://lookas2001.com/%e8%a6%81%e7%bb%93%e6%9d%9f%e4%ba%86%e5%95%8a/ Https://lookas2001.com/%e8%a6%81%e7%bb%93%e6%9d%9f%e4%ba%86%e5%95%8a/#respond Sun, 06 Jan 2019 14:44:38 +0000 Https://lookas2001.com/? P=313 Continue reading "It's coming to an end."

> >
It's coming to an end.

NOIP 2018394 points. At that time, I also thought that the score could be ignorant, but I didn't know that the players of the powerful provinces were already outside 500 points. No, actually I know, but I don't want to admit it. 3 years of time were abandoned by me, and I still did not grasp it for 1 years. By now, everything is coming to an end.

Without Tsinghua north winter camp's invitation, for me, if I want to go to Tsinghua University by way of competition, the only one left is NOI gold medal.

But no, but ah. How can I catch up with too many people in my next 6 months?

How come?

Let's end it all.

The CCF winter camp in January 24th will be my last exam. It was the first and last time in the school of Guang two.

Bless and bless my classmates who come all the way.

I hope you can achieve a good result in the NOI competition in 2019, and be careful on the way!

Thank you, thank you all the way to support me step by step, teachers and parents.

Although I didn't let you see me at the moment in the NOI arena, but in my long and short OI career, you gave me knowledge, and most importantly, warmth and companionship.

May we have the pleasure of seeing you again in the coming year.


January 6th in Guangzhou

> >
Https://lookas2001.com/%e8%a6%81%e7%bb%93%e6%9d%9f%e4%ba%86%e5%95%8a/feed/ Zero Three hundred and thirteen
NOIP 2018 travels Https://lookas2001.com/noip-2018-%e6%b8%b8%e8%ae%b0/ Https://lookas2001.com/noip-2018-%e6%b8%b8%e8%ae%b0/#respond Mon, 26 Nov 2018 12:26:02 +0000 Https://lookas2001.com/? P=298 Continue reading "NOIP 2018 travels"

> >
Change, this is my summary of this year's NOIP, from the site selection of the Tianjin competition area to the new campus, and to CCF update the "master machine" which has been criticized for countless times by the numerous players, it can be seen that NOIP's continuous improvement and the degree of attention are constantly improving. Talk nonsense. Let's talk about the idea of this examination.

Day 1

The first question is paved the road, a simple greedy, casually playing a tree array 30min A to cut the next question (actually time is longer than 30 minutes).

I saw second questions, math and math questions. However, a simple analysis can show that if a number can be expressed by other numbers, then this number is useless. Otherwise, it must be useful (obviously). The hand played several sets of samples, and found that the thought was correct, and then played a sieve, 1H A finished and cut a problem. There is a hole in the sieve. Like Euler sieve, a mark must be made, otherwise the complexity will not guarantee that it will be properly T.

Then go to the bathroom. Take a breath of fresh air. Maybe 2.5h has passed.

Look at the third question. After reading two times, I found that it was a tree like dynamic programming. Unfortunately, my tree dynamic programming was learned last week, knocking out violence, writing a pair of shots, and getting several sets of test data to test and hand over.

The topic of Day 1 this year is that it has all been hit by the Internet, but unfortunately I haven't done it yet (ZG Dalao two months A dropped 300 topics%%%).

Day 2

After reading the question, it is found that the data of the first question is particularly magical. It is a single loop tree. It considers the upper part of the broken ring and then enumerates it. So the complexity is O (n^2), but it also requires the smallest. So the idea in the examination room is to arrange the sequence again, O (n^2logn). Considering that this year's CCF is changing the testing machine, and because there is not a lot of things that will be changed every time, there is no way to think about it. Luckily, I finally asked for my "excellent" card skills. Specifically, using vector to save edges is T.

The second question is "Cao", which is a mathematical problem. However, because of its high heart, it made a mistake in the examination. It is hard to resist. It turned out that if I hadn't had a big fortune, I would have adjusted the T3 in the last 30 minutes, otherwise it would be cool. It took me 1 hours to finish the task, but finally I decided to change the topic and reduce the loss. After the last question came out, I came back to find several sets of idiot data. I knocked on a watch and handed it up. Finally, I only got 5 points on the basis of the violence. Thank CCF for the weak data.

Third question, this is NOI Plus. No, a violent fight was made.


Generally speaking, experience is OK, but the mistakes made before, this time, the time planning is really, very, very important.

In addition, I feel that this game itself is very bad, because I always insist on the principle of code readability, resulting in my code generally more than 2 times longer than others, this may be changed, after all, playing a competitive game, rather than long-term maintenance of the project.

394, I have been very satisfied with the achievement of nearly 400 points.

NOI 2019, we'll see you next year!

The picture is NOIP 2018 Tianjin examination hall, Tianjin University Beiyang garden campus.

> >
Https://lookas2001.com/noip-2018-%e6%b8%b8%e8%ae%b0/feed/ Zero Two hundred and ninety-eight
Struggle! Https://lookas2001.com/%e5%a5%8b%e6%96%97%ef%bc%81/ Https://lookas2001.com/%e5%a5%8b%e6%96%97%ef%bc%81/#respond Mon, 17 Sep 2018 11:10:57 +0000 Https://lookas2001.com/? P=282 Continue reading "Struggle!"

> >
Afternoon, sunlight into the study room, warm and not dazzling. It's probably the best time of life to sit in a place with the physical chemistry students who are in the team.

But I am different from them. I only have this chance. Success or failure is at the same time.

I am not an ordinary child, I will make my own career. This is what I have always told myself, past, present and future.

Come on, hold on to every minute and fight!

> >
Https://lookas2001.com/%e5%a5%8b%e6%96%97%ef%bc%81/feed/ Zero Two hundred and eighty-two
Ideal and reality Https://lookas2001.com/%e7%90%86%e6%83%b3%e4%b8%8e%e7%8e%b0%e5%ae%9e/ Https://lookas2001.com/%e7%90%86%e6%83%b3%e4%b8%8e%e7%8e%b0%e5%ae%9e/#comments Sun, 24 Jun 2018 15:04:32 +0000 Https://lookas2001.com/? P=263 Continue reading "Ideal and reality"

> >
A pile of texts didn't recite, and a lot of things didn't work. It's very frustrating today.

In fact, you know, I know why my project has not made any significant progress since 4 years ago. Maybe I was too idealistic. I gave too many labels to me. Just like father had too many thoughts on his children, I didn't find the key, so that I couldn't achieve it. In fact, this is also part of my action. I am wrong in thinking all the time instead of doing it. It has always been TODO, not Do.

I have to rely on my wish to achieve something, or I want to be respected and respected like some celebrities, but I am wrong. I have been talking about human rights and protecting personal privacy, but if I suddenly have power and status, will I still think so? While I am protecting my personal privacy, what am I doing? I have climbed other people's achievements to spy on other people's privacy. My appeal is not vigorous. What makes people speechless is that I want others to follow my thoughts, but I don't want to admit other people's hobbies. This is a sick way of thinking.

Then again, why am I in a bad mood today? Human beings are a very amazing animal. They always have unrealistic expectations for something. In fact, I am already very good, but I want to get better, but I do not want to pay the price. It is ridiculous, but it is indeed my status quo, I need to change.

I need to change, but I am also confused. What should I change? Next, where should I go? I hope that after a few years, I will not be depressed when I see these words. Fighting!

> >
Https://lookas2001.com/%e7%90%86%e6%83%b3%e4%b8%8e%e7%8e%b0%e5%ae%9e/feed/ Two Two hundred and sixty-three
Keep exploring, long live curiosity! Https://lookas2001.com/keep-curious-explore-endlessly/ Https://lookas2001.com/keep-curious-explore-endlessly/#respond Fri, 01 Jun 2018 14:00:10 +0000 Https://lookas2001.com/? P=247 Continue reading "Keep exploring, long live curiosity!"

> >

This is the first part of the lookas2001 writing program, and also part of the lookas2001 trial series.

In the lookas2001 trial series, I will understand and learn all kinds of abilities that I have never had or dare not try before, try my best to broaden my knowledge, exercise my cognitive ability, and make minor but possibly great changes for this huge world.

June 1st, international children's day. This is my seventeenth children's day. For me, this is probably the last second children's day before my adult life. Obviously, I am no longer the pure and lovely me, but I wonder why I am not, what changes have been made, and what I have gained or lost. In memory of my childhood and my passing youth, as well as the opening of this series, I will provide a direction for future exploration. Here, I write this article.

First of all, to answer the questions raised at the beginning, I think the biggest change is: I lost the curiosity I had always been proud of. Yes, no other, although I know that the world is still very large, but slowly, I become more and more lazy to explore the world, no longer willing to take steps to get out of my comfort zone. The more and more solidified learning and life, facing the computer day after day, the headaches of social networking, I feel more and more boring. Because of this, my time is getting faster and faster. It's like an upright walking corpse. Life without curiosity can be boring and insane. Oh, my God, this is really a horrible thing.

If the development of things is bestowed by the wisdom of mankind, the wisdom of human beings is the result of curiosity. As early as nineteenth Century, there was a saying in Marx's philosophy created by Marx: "contradictions within things are the source and motive force for the development of things." Now, it still has a very strong reference significance. People are exploring because they do not know what they are not clear about. As a new force in the development of the world, curiosity is always the most important thing. If order is needed for human ability, curiosity can definitely be put into the first batch. As wiki said, "curiosity and human development at all levels are highly relevant. Curiosity can lead to learning process and desire to understand knowledge and skills." She strongly promotes human development, and human development is inseparable from curiosity.

We are familiar with the great masters who have made great contributions to the cause of human science in nature and humanities. Take the example of MIT, a world famous school, where children love mischief, and their school has deliberately created a trick Museum for their prank. This allows us to accept the education of a good baby all the year round. We can not understand this prank culture. But at the same time, we should think that these children who make practical jokes have hollow their mind in order to create an eye catching and creative trick. This is the driving force of curiosity. The growth of these people as adults is the unyielding force for the continued prosperity of the United States, and the United States is still the most powerful country in the world.

Just like dead wood and hard rock, a person's loss of curiosity means that he has lost the ability to explore and change himself and the world. If a country or a nation loses its curiosity, it will be a symbol of the change of state power or the decline of a nation. In history, there are so many generals who lost their defeat because of curing thinking. How many countries failed to last for a few years because they did not think about new ideas, and how many people lost their ability to explore.

In the end, I also wish everyone can keep their instinct to explore the world, keep on wondering and never give up their efforts to change the world. Of course, I also want to be able to read the readers here, constantly reflect on whether they stop the pace of discovery, whether they are satisfied with the status quo and unwilling to change, and whether they have given up the ability to think.

Happy children's Day!

Long live curiosity!


> >
Https://lookas2001.com/keep-curious-explore-endlessly/feed/ Zero Two hundred and forty-seven