摘要:给出一个数N,求1至N中,有多少个数不是2 3 5 7的倍数。 例如N = 10,只有1不是2 3 5 7的倍数。 收起 输入 输入1个数N(1 <= N <= 10^18)。 输出 输出不是2 3 5 7的倍数的数共有多少。 输入样例 10 输出样例 1 思路 :容斥原理 如果被计数的事物有A、B
阅读全文
摘要:#include<cstdio>#include<cstring>#include<cmath>#include<algorithm>#include<iostream> using namespace std; #define ll long long#define N 110000int s[N
阅读全文
摘要:Tick and Tick Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 20120 Accepted Submission(s): 5262
阅读全文
摘要:http://blog.csdn.net/iamzky/article/details/22712347 http://blog.csdn.net/quack_quack/article/details/50620052 http://www.gatevin.moe/acm/fft算法学习笔记/
阅读全文
摘要:1336 - Sigma Function Sigma function is an interesting function in Number Theory. It is denoted by the Greek letter Sigma (σ). This function actually
阅读全文
摘要:1282 - Leading and Trailing You are given two integers: n and k, your task is to find the most significant three digits, and least significant three d
阅读全文
摘要:1236 - Pairs Forming LCM Find the result of the following code: long long pairsFormLCM( int n ) { long long res = 0; for( int i = 1; i <= n; i++ ) for
阅读全文
摘要:1215 - Finding LCM LCM is an abbreviation used for Least Common Multiple in Mathematics. We say LCM (a, b, c) = L if and only if L is the least intege
阅读全文
摘要:1213 - Fantasy of a Summation If you think codes, eat codes then sometimes you may get stressed. In your dreams you may see huge codes, as I have seen
阅读全文
摘要:1163 - Bank Robbery In one very cold morning, Mark decides to rob a bank. But while trying hacking into the security system, he found that it is locke
阅读全文
摘要:1138 - Trailing Zeroes (III) You task is to find minimal natural number N, so that N! contains exactly Q zeroes on the trail in decimal notation. As y
阅读全文
摘要:1045 - Digits of Factorial Factorial of an integer is defined by the following function f(0) = 1 f(n) = f(n - 1) * n, if(n > 0) So, factorial of 5 is
阅读全文
摘要:1035 - Intelligent Factorial Factorization Given an integer N, you have to prime factorize N! (factorial N). Input Input starts with an integer T (≤ 1
阅读全文
摘要:1028 - Trailing Zeroes (I) We know what a base of a number is and what the properties are. For example, we use decimal number system, where the base i
阅读全文
摘要:1014 - Ifter Party I have an Ifter party at the 5th day of Ramadan for the contestants. For this reason I have invited C contestants and arranged P pi
阅读全文
摘要:1170 - Counting Perfect BST BST is the acronym for Binary Search Tree. A BST is a tree data structure with the following properties. i) Each BST conta
阅读全文
摘要:1140 - How Many Zeroes? Jimmy writes down the decimal representations of all natural numbers between and including m and n, (m ≤ n). How many zeroes w
阅读全文
摘要:1102 - Problem Makes Problem As I am fond of making easier problems, I discovered a problem. Actually, the problem is 'how can you make n by adding k
阅读全文
摘要:1095 - Arrange the Numbers Consider this sequence {1, 2, 3 ... N}, as an initial sequence of first N natural numbers. You can rearrange this sequence
阅读全文
摘要:1058 - Parallelogram Counting There are n distinct points in the plane, given by their integer coordinates. Find the number of parallelograms whose ve
阅读全文