【CodeForces 577C】Vasya and Petya’s Game
链接
某个数x属于[1,n],至少询问哪些数y“x是否是y的倍数”才能判断x。
找出所有质因数和质因数的幂即可。
#include<cstdio> #include<algorithm> #define N 1005 using namespace std; int n,pr[N],ans[N],cnt; int main(){scanf("%d",&n);for(int i=2;i<=n;i++)if(!pr[i])for(int j=i*2;j<=n;j+=i)pr[j]++;for(int i=2;i<=n;i++)if(pr[i]<2)ans[cnt++]=i;printf("%d\n",cnt);for(int i=0;i<cnt;i++)printf("%d ",ans[i]); }
【CodeForces 577C】Vasya and Petya’s Game相关推荐
- 【CodeForces - 1051C 】Vasya and Multisets (模拟)
题干: Vasya has a multiset ss consisting of nn integer numbers. Vasya calls some number xxnice if it a ...
- 【CodeForces - 1051A】Vasya And Password (构造,水题)
题干: Vasya came up with a password to register for EatForces - a string ss. The password in EatForces ...
- 【CodeForces - 144C】Anagram Search(尺取,滑窗问题,处理字符串计数)
题干: A string t is called an anagram of the string s, if it is possible to rearrange letters in t so ...
- 【CodeForces - 574B】Bear and Three Musketeers (枚举边,思维,优秀暴力)
题干: Do you know a story about the three musketeers? Anyway, you will learn about its origins now. Ri ...
- 【CodeForces - 608C】Chain Reaction (二分 或 dp ,思维)
题干: 题目大意: 题意是在一条直线上坐落着不同位置的灯塔,每一个灯塔有自己的power level,当作是射程范围.现在从最右边的灯塔开始激发,如果左边的灯塔在这个灯塔的范围之内,那么将会被毁灭.否 ...
- 「一题多解」【CodeForces 85D】Sum of Medians(线段树 / 分块)
题目链接 [CodeForces 85D]Sum of Medians 题目大意 实现一个setsetset,支持插入,删除,求∑a5k+3∑a5k+3\sum a_{5k+3}.注意,setsets ...
- 【CodeForces 997C】Sky Full of Stars(组合计数)
题目链接:[CodeForces 997C]Sky Full of Stars 官方题解:Codeforces Round #493 - Editorial 题目大意:有一个n×nn×nn\times ...
- 【codeforces 812C】Sagheer and Nubian Market
[题目链接]:http://codeforces.com/contest/812/problem/C [题意] 给你n个物品; 你可以选购k个物品;则 每个物品有一个基础价值; 然后还有一个附加价值; ...
- 【codeforces 508B】Anton and currency you all know
[题目链接]:http://codeforces.com/contest/508/problem/B [题意] 给你一个奇数; 让你交换一次数字; 使得这个数字变成偶数; 要求偶数要最大; [题解] ...
最新文章
- 任天堂新音樂遊戲上市
- visual studio 重命名项目和程序集名称
- SAP ABAP:获取汇率的完整实现之一
- BUUCTF(pwn)picoctf_2018_are you root
- python3精要(23)-递归与函数列表
- boost::mpl模块实现inherit相关的测试程序
- loj#2143. 「SHOI2017」组合数问题
- LeetCode 1177. 构建回文串检测(前缀和)
- html把图片定位在盒子中心,html – CSS在图像的右上角定位一个图标
- 字符串_KMP算法(求next[]模板 hdu 1711)
- python deap_遗传算法库DEAP的示例代码的学习和分析
- TeamViewer远程控制软件,让你享受远程办公的便利
- STM32F10x_StdPeriph_Template
- 开发板的lcd 显示
- 二维码活码源码(含数据库脚本)
- 作为一个程序员应该看的书籍
- 2022icpc昆明
- 「Adobe国际认证」设计小白必须了解的色彩理论,绝对干货满满
- 给所有想爱、正在爱、失去爱的人(转)
- 计算机有60进制吗,60进制介绍