【HDOJ5447】Good Numbers(数论)】的更多相关文章

  Carmichael Numbers  An important topic nowadays in computer science is cryptography. Some people even think that cryptography is the only important field in computer science, and that life would not matter at all without cryptography. Alvaro is one…
UVA 10539 - Almost Prime Numbers 题目链接 题意:给定一个区间,求这个区间中的Almost prime number,Almost prime number的定义为:仅仅能整除一个素数. 思路:既然是仅仅能整除一个素数,那么这些数肯定为素数的x次方(x > 1),那么仅仅要先打出素数表,然后在素数表上暴力找一遍就能够了,由于素数表仅仅要找到sqrt(Max),大概100W,然后每一个数找的复杂度为log(n),这样复杂度是能够接受的. 代码: #include <…
DZY Loves Fibonacci Numbers Time Limit:4000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Appoint description:  System Crawler  (2014-07-14) Description In mathematical terms, the sequence Fn of Fibonacci numbers is defi…
题目链接:POJ 3641 Description Fermat's theorem states that for any prime number p and for any integer a > 1, ap = a (mod p). That is, if we raise a to the pth power and divide by p, the remainder is a. Some (but not very many) non-prime values of p, know…
题目链接. 题意: 找一个n,和一个m(m < n),求使得1~m的和等于m~n的和,找出10组m,n 分析: 列出来式子就是 m*(m+1)/2 = (n-m+1)*(m+n)/2 化简后为 m*m*2 = n*(n+1) 可以枚举n,然后二分找m,不过这样大约会用10s多,可以打表. 打表程序: #include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #…
http://codeforces.com/problemset/problem/899/C tot为奇数时,绝对差为1:tot为偶数时,绝对差为0. 难点在于如何输出. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<cstdlib> #include<cmath> #include<vector> #i…
题意: 对于某数k,若数字d在1-k中出现次数恰好为k,则称k为好数. 给定d,x,求x以内,对于d而言最大的好数.k范围1e18. 题解: 打表二分即可. 但是,1e18的表是没法打出来的,只能在oeis.org上查出来 #include<iostream> #include<cstdio> #include<cstring> #include<cmath> #include<string> #include<stack> #inc…
杭电ACM分类: 1001 整数求和 水题1002 C语言实验题——两个数比较 水题1003 1.2.3.4.5... 简单题1004 渊子赛马 排序+贪心的方法归并1005 Hero In Maze 广度搜索1006 Redraiment猜想 数论:容斥定理1007 童年生活二三事 递推题1008 University 简单hash1009 目标柏林 简单模拟题1010 Rails 模拟题(堆栈)1011 Box of Bricks 简单题1012 IMMEDIATE DECODABILITY…
转载:from http://blog.csdn.net/qq_28236309/article/details/47818349 基础题:1000.1001.1004.1005.1008.1012.1013.1014.1017.1019.1021.1028.1029. 1032.1037.1040.1048.1056.1058.1061.1070.1076.1089.1090.1091.1092.1093. 1094.1095.1096.1097.1098.1106.1108.1157.116…
题意: 思路:From https://blog.csdn.net/qq_36553623/article/details/76683438 大概就是把1e6里面的质因子能除的都除光之后借助两者gcd中有最大质因子的条件分类讨论 其实也就5类,重点是如何设分类的标准,其实唯一的标准就是对答案的贡献 int128本机环境跑不了,只能交上去的时候改,总觉得有朝一日要掉坑里 #include<bits/stdc++.h> using namespace std; typedef long long…