# BZOJ2440 (full number of shards) Dual + Mobius

Source: Internet
Author: User

Full score refers to the number of score factors. Calculate the number of non-complete records of the ki number.

Solution: an obvious binary algorithm. getsum (int middle) is used to calculate the number of non-full partitions in 1-middle, and then a binary algorithm. 1. Calculate the number of non-full partitions of the middle and then subtract the number of full partitions from the total number. Describe the total number of shards:

First add n/(2*2) + n/(3*3) + n/(5*5) + n/(7*7 )... +... then, subtract the one that appears twice, and add the following three times... odd addition and even subtraction. This is the prototype of mou, which is easy to calculate using the mou array;

Code:

```/******************************************************* @author:xiefubao*******************************************************/#pragma comment(linker, "/STACK:102400000,102400000")#include

#include

#include

#include

#include

#include

#include #include

#include
#include

#include

#include

//freopen ("in.txt" , "r" , stdin);using namespace std;#define eps 1e-8#define zero(_) (abs(_)<=eps)const double pi=acos(-1.0);typedef unsigned long long LL;const int Max=100010;const LL INF=2e16+7;LL mou[Max];void init(){ for(LL i=2; i

>t; while(t--) { scanf("%d",&k); LL left=1,right=INF; while(left<=right) { int middle=(left+right)/2; if(getnum(middle)

```
Related Keywords:
Related Article

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

## A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

• #### Sales Support

1 on 1 presale consultation

• #### After-Sales Support

24/7 Technical Support 6 Free Tickets per Quarter Faster Response

• Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.