题解:

首先分析一下这个问题

发现等价于是求n之内与n互素的数的个数,即欧拉函数

这个可以线性筛

但发现还应该减去$x^2==1$的情况

这个东西不是那么好处理

考虑用中国剩余定理拆

因为$p1^{a1}*p2^{a2}*p3^{a3}....$这些是互素的

所以拆完后的方程的解和原方程是唯一对应的

问题变成$x^2 \equiv 1  (mod \ pi^{ai})$

移项变成$(x-1)(x+1) \equiv1 (mod \ pi^{ai})$

注意到当$pi>2$时$pi$不可能同时整除$(x-1)$ $(x+1)$

即一定要有一个等于0,所以有两个解

当$pi=2$的时候,分ai讨论一下 $1-->1 \ \ \ \ 2-->2  \ \ \ \ (>3)-->4$

Snakes 的 Naïve Graph的更多相关文章

  1. loj Snakes 的 Naïve Graph 【数论】

    题目链接 loj 题解 感谢珂神的指导orz 观察式子\(i \times j \equiv 1 \pmod m\),显然\(i,j\)是模\(m\)意义下成对的逆元,只需统计模\(m\)意义下存在逆 ...

  2. [开发笔记] Graph Databases on developing

    TimeWall is a graph databases github It be used to apply mathematic model and social network with gr ...

  3. Introduction to graph theory 图论/脑网络基础

    Source: Connected Brain Figure above: Bullmore E, Sporns O. Complex brain networks: graph theoretica ...

  4. POJ 2125 Destroying the Graph 二分图最小点权覆盖

    Destroying The Graph Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 8198   Accepted: 2 ...

  5. [LeetCode] Number of Connected Components in an Undirected Graph 无向图中的连通区域的个数

    Given n nodes labeled from 0 to n - 1 and a list of undirected edges (each edge is a pair of nodes), ...

  6. [LeetCode] Graph Valid Tree 图验证树

    Given n nodes labeled from 0 to n - 1 and a list of undirected edges (each edge is a pair of nodes), ...

  7. [LeetCode] Clone Graph 无向图的复制

    Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors. OJ's ...

  8. 讲座:Influence maximization on big social graph

    Influence maximization on big social graph Fanju PPT链接: social influence booming of online social ne ...

  9. zabbix利用api批量添加item,并且批量配置添加graph

    关于zabbix的API见,zabbixAPI 1item批量添加 我是根据我这边的具体情况来做的,本来想在模板里面添加item,但是看了看API不支持,只是支持在host里面添加,所以我先在一个ho ...

随机推荐

  1. 对称加密之AES加密详解

    最近有人问我AES对称加密是啥,我回答了个大概,发现自己不能清晰的讲出来,特此记录,以供学习 一.对称加密 对称加密是最快速.最简单的一种加密方式,加密(encryption)与解密(decrypti ...

  2. C#使用WindowsMediaPlayer实现视频播放

    using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using Sy ...

  3. jacoco+maven 初次使用覆盖率工具

    工作要搞覆盖率测试,看到公司平台上用的jacoco,就找了网上的demo自己跑了一下. 一.覆盖率测试是干什么的 http://www.open-open.com/lib/view/open14721 ...

  4. C语言博客05--指针

    C语言博客05--指针 1.本章学习总结 1.1 思维导图 1.2 本章学习体会及代码量学习体会 1.2.1 学习体会 在本周的学习过程中,我们学习了指针的用法.说实话,指针的用法有点绕,之前一直没搞 ...

  5. awk删除重复文件

    #!/bin/bash #查找并删除重复文件,每个文件只保留1份 ls -LS --time-style=long-iso | awk 'BEGIN { getline; getline; name1 ...

  6. docker学习------centos7.5下的swarm集群可视化构建

    1.swarm集群 manager : 192.168.211.175 agent1    : 192.168.211.176    agent2    :  192.168.211.177 2.环境 ...

  7. SQLServer2012基于扩展事件的阻塞监控

    一.前言 SQL阻塞Block是事务联机系统OLTP的产物.由于锁导致的资源等待,事务执行时间过长,直接影响业务:了解阻塞,发现阻塞,已作为DBA日常维护的重中之重. 通过dmv可以发现当前正在阻塞的 ...

  8. 异常处理--logging模块

    一. 异常处理 1. 异常类型: 语法错误 : 空格 缩进 语法规则 应该在我们写代码的时候就避免 逻辑错误: 应该在程序当中写代码处理 条件判断 异常处理 2. 常见的报错类型: Attribute ...

  9. docker搭建及使用:centos7.0+docker+flask+nginx

    flask笔记: centos7安装Docker: yum install docker 启动docker服务: service docker start 构建基本镜像: sudo docker pu ...

  10. DoraBox 漏洞练习平台

     项目地址: https://github.com/gh0stkey/DoraBox SQL注入 SQLi 数字型 判断表中有多少列 http://127.0.0.1/DoraBox/sql_inje ...