欧拉线性素数筛(转)

简介

在埃氏筛中,我们会重复筛到同一个数,例如12同时被2和3筛到,15同时被3和5筛到。所以我们引入欧拉筛,也叫线性筛,可以在$O(n)$的时间内完成对2~n的筛选。它的核心思想是:让每一个最小的合数被其最小质因数筛到


(数论)康托展开和逆康托展开

简介

康托展开是一个全排列到自然数的双射,常用于构建hash表来实现空间压缩。设$n$个数$(1,2,3,4,\cdots n)$,可以组成$n!$种排列,康托展开表示的就是当前的排列在所有组合中的名次。


1003 Emergency-PAT甲级

题目描述

As an emergency rescue team leader of a city, you are given a special map of your country. The map shows several scattered cities connected by some roads. Amount of rescue teams in each city and the length of each road between any pair of cities are marked on the map. When there is an emergency call to you from some other city, your job is to lead your men to the place as quickly as possible, and at the mean time, call up as many hands on the way as possible.


1002 A+B for Polynomials-PAT甲级

题目描述

This time, you are supposed to find A+B where A and B are two polynomials.


Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×