ICode9

精准搜索请尝试: 精确搜索
  • [CF191C] Fools and Roads - LCA,树上差分2020-12-04 12:02:37

    Description 有一颗 \(n\) 个节点的树,\(k\) 次旅行,问每一条边被走过的次数。 Solution 模板题,复习一下 LCA 与树上差分的基本用法。 首先,对于每条边被走过的次数,我们把它转化为深度较大的那个点被经过的次数。 对于每一次旅行 \(begin,end\),计算 \(lca=LCA(begin,end)\),则每次操

  • 欧拉函数2020-10-08 19:32:23

    #define Max 1000001 int euler[Max]; void Init(){ euler[1]=1; for(int i=2;i<Max;i++) euler[i]=i; for(int i=2;i<Max;i++) if(euler[i]==i) for(int j=i;j<Max;j+=i) euler[j]=euler[j]/i*(i-1);//先进行除

  • 题解 UVA10311 【Goldbach and Euler】2020-08-29 10:31:47

    实际发表时间:2020-04-15 https://www.luogu.com.cn/problem/UVA10311 题目大意: 判断一个数是不是两个不同质数的和,然后按指定格式输出 我们先可以判断此数的奇偶性 如果是奇数,因为奇数只能是一奇一偶的和,偶质数又只有2,所以判断\(n-2\)是否是质数即可 如果是偶数,我们从中间开始查

  • The Euler function 线性筛法求欧拉函数2020-07-29 17:31:43

    题目: 查看原题点击这里-->传送门 题目大意就是随意输入两个数 a,b;输出a到b之间的每个数的欧拉函数之和; 思路: 题目中最大的数是3000000,我们可以先把1~3000000对应的每个数的欧拉函数求解出来。 然后再用一个前缀和数组求出1~3000000对应的欧拉函数之和。 但问题的关键是怎么求出每

  • Educational Codeforces Round 81 (Rated for Div. 2) - D. Same GCDs - 扩欧+欧拉函数2020-01-30 14:04:51

    题目链接:https://codeforces.com/contest/1295/problem/D 题目大意: 多样例 给你一个a和m。问有多少个x(0<=x<m) 使得gcd(a, m)=gcd(a+x, m)。 思路:根据扩欧定理: gcd(a+x, m)= gcd((a+x)%m, m) (a+x)%m的取值可能是[0, m-1]。 gcd(a+x, m)= gcd(a, m) 1:如果gcd(a, m)=1。那么就是求gc

  • Day7 - D - The Euler function HDU - 28242020-01-20 20:52:50

    The Euler function phi is an important kind of function in number theory, (n) represents the amount of the numbers which are smaller than n and coprime to n, and this function has a lot of beautiful characteristics. Here comes a very easy question: suppos

  • 欧拉函数2020-01-14 09:09:38

    The Euler function phi is an important kind of function in number theory, (n) represents the amount of the numbers which are smaller than n and coprime to n, and this function has a lot of beautiful characteristics. Here comes a very easy question: suppos

  • Project Euler 做题记录2020-01-09 13:03:10

    Project Euler 太好玩了。。。(雾 Problem 675 设 \(\omega(n)\) 表示 \(n\) 的质因子个数,\(S(n)=\sum_{d|n}2^{\omega(d)}\),求 \(F(n)=\sum_{i=2}^nS(i!) \bmod (10^9+87)\)。 \(n=10^7\) solution \(n=\prod_{i=1}^kp_i^{e_i}\) \(S(n)=\prod_{i=1}^k(2e_i+1)\) 线性筛求出每

  • 混凝土爆炸破坏模拟2019-12-27 19:50:44

    本文采用WorkBench的autodyn模块对混凝土爆炸破坏进行了模拟仿真。 本文主要参考** ANSYS Autodyn 简介II Explosive Demolition of Concrete ** 目标和过程 对混凝土板的爆炸破坏进行模拟。 打开AUTODYN 设置为二维轴对称模拟 对混凝土采用Lagrange建模 对爆炸物采用Euler

  • 实验一:状态方程、传函为模型的系统的仿真2019-11-11 19:02:26

    一、实验目的  1. 掌握各数学模型之间的转换与数学模型的参数获取,掌握相关MATLAB命令  2. 掌握欧拉法和RK法的递推公式  3. 掌握欧拉法和RK法的MATLAB算法实现 二、实验内容  1. 分别用欧拉法和四阶龙格-库塔法求解如下系统:  (1) R=4KΩ, C=1µF, L=1H, 仿真时间: 0.03s  

  • P 1007 素数对猜想2019-10-04 14:54:27

      日常水题,虽然要期中考试了,但提还是要水的,一共95题,早晚能水完。来来来,看题!   到目前为止,我发现乙题普遍需求明确。思路也很明确。这道题两种方法。   第一种:动态查找,从最大或最小的开始查找,并且从第二个素数出现开始,依次与上一个进行比较,从而确定素数对的个数。   第二种

  • Project Euler:Problem 12019-08-01 20:40:25

    原文链接:http://www.cnblogs.com/riceLee/archive/2013/03/07/problem1.html problem: Multiples of 3 and 5 If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Fi

  • 【数的专题】——欧拉筛2019-07-08 15:55:34

    上题:https://www.luogu.org/problemnew/show/P3383 当你总是觉得筛质数太慢的时候,不妨来试一下欧拉筛: 基本原理: 设一个整数x,保证它只被它的最小质因子筛去。 具体请看代码:   1 #include<bits/stdc++.h> 2 using namespace std; 3 const int N=1e7+10; 4 bool check[N]; 5 int an

  • acm数学板块学习之欧拉定理及拓展欧拉定理2019-04-20 13:56:53

    持续更新ing 欧拉函数 对正整数n,欧拉函数是小于n的正整数中与n互质的数的数目(φ(1)=1)。例如φ(8)=4,因为1,3,5,7均和8互质。 欧拉函数公式:euler(x) = x*(1-1/p1)(1-1/p2)……(1-1/pn),p为x的质因数。 性质: 一个数x的所有质因数的和euler(n)*n/2 欧拉数在n>2时,必定为偶数 质数x

  • Project Euler 52019-04-02 16:53:08

    Problem 5 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? Solve: clearclcfor i = 100:20:100000

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有