题目描述: Soldier and Number Game time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Two soldiers are playing a game. At the beginning first of them chooses a positive integer n and gives it to t…
D. Soldier and Number Game time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Two soldiers are playing a game. At the beginning first of them chooses a positive integer n and gives it to the…
题目链接: C. Primes or Palindromes? time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Rikhail Mubinchik believes that the current definition of prime numbers is obsolete as they are too complex…
题目链接: A. Mashmokh and Numbers time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output It's holiday. Mashmokh and his boss, Bimokh, are playing a game invented by Mashmokh. In this game Mashmokh wri…
类似筛素数的方法……求出前缀和.然后直接O(1)回答即可. #include <bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i(a); i <= (b); ++i) + ; int num[N]; bool p[N]; int T, n, m; int main(){ memset(p, true, sizeof p); memset(num, , sizeof num); p[] = false; rep…
Nico Number Time Limit: 2 Seconds      Memory Limit: 262144 KB Kousaka Honoka and Minami Kotori are playing a game about a secret of Yazawa Nico. When the game starts, Kousaka Honoka will give Minami Kotori an array A of N non-negative integers. Ther…
题目:戳我这个题与HDUOJ 5317有异曲同工之妙 题意:题意看懂了上面的一大串英文之后其实很简单,就是给你一个正整数n,问你n有多少个质因子,不过这里n是通过a!/b!给定的,也就是说n=(a!/b!); 分析:由于这里1 ≤ b ≤ a ≤ 5 000 000,数据很大,所以简单暴力一定超时,具体看代码. #include <iostream> #include <cstdio> using namespace std; ; int t; //测试组数 }; //打表,将n的…
Two soldiers are playing a game. At the beginning first of them chooses a positive integer n and gives it to the second soldier. Then the second one tries to make maximum possible number of rounds. Each round consists of choosing a positive integer x…
题目链接 这个题, 告诉你a, b的值, 那么只需要求出b到a之间的数, 每个数有多少个因子就可以. 具体看代码, 代码里面有解释 #include<bits/stdc++.h> using namespace std; #define pb(x) push_back(x) ; int p[maxn], c[maxn]; int main() { memset(p, , sizeof(p)); memset(c, , sizeof(c)); ; i<=maxn; i++) { if(!p…
求素数 题目描述 求小于n的所有素数的数量. 输入 多组输入,输入整数n(n<1000000),以0结束. 输出 输出n以内所有素数的个数. 示例输入 10 0 示例输出 4 提示 以这道题目为例,要找出n以内的素数, n<=1000000. 为了节省时间,用素数筛 先把1000000以内的素数全部标记出来! 埃拉托斯特尼筛法,此素数筛核心算法代码: 这样跑完这个代码,是素数的会标记为0, 不是素数的标记为1.  数据处理完毕! int f[1000004]; int i, j; memset…