链接

某个数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相关推荐

  1. 【CodeForces - 1051C 】Vasya and Multisets (模拟)

    题干: Vasya has a multiset ss consisting of nn integer numbers. Vasya calls some number xxnice if it a ...

  2. 【CodeForces - 1051A】Vasya And Password (构造,水题)

    题干: Vasya came up with a password to register for EatForces - a string ss. The password in EatForces ...

  3. 【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 ...

  4. 【CodeForces - 574B】Bear and Three Musketeers (枚举边,思维,优秀暴力)

    题干: Do you know a story about the three musketeers? Anyway, you will learn about its origins now. Ri ...

  5. 【CodeForces - 608C】Chain Reaction (二分 或 dp ,思维)

    题干: 题目大意: 题意是在一条直线上坐落着不同位置的灯塔,每一个灯塔有自己的power level,当作是射程范围.现在从最右边的灯塔开始激发,如果左边的灯塔在这个灯塔的范围之内,那么将会被毁灭.否 ...

  6. 「一题多解」【CodeForces 85D】Sum of Medians(线段树 / 分块)

    题目链接 [CodeForces 85D]Sum of Medians 题目大意 实现一个setsetset,支持插入,删除,求∑a5k+3∑a5k+3\sum a_{5k+3}.注意,setsets ...

  7. 【CodeForces 997C】Sky Full of Stars(组合计数)

    题目链接:[CodeForces 997C]Sky Full of Stars 官方题解:Codeforces Round #493 - Editorial 题目大意:有一个n×nn×nn\times ...

  8. 【codeforces 812C】Sagheer and Nubian Market

    [题目链接]:http://codeforces.com/contest/812/problem/C [题意] 给你n个物品; 你可以选购k个物品;则 每个物品有一个基础价值; 然后还有一个附加价值; ...

  9. 【codeforces 508B】Anton and currency you all know

    [题目链接]:http://codeforces.com/contest/508/problem/B [题意] 给你一个奇数; 让你交换一次数字; 使得这个数字变成偶数; 要求偶数要最大; [题解] ...

最新文章

  1. 任天堂新音樂遊戲上市
  2. visual studio 重命名项目和程序集名称
  3. SAP ABAP:获取汇率的完整实现之一
  4. BUUCTF(pwn)picoctf_2018_are you root
  5. python3精要(23)-递归与函数列表
  6. boost::mpl模块实现inherit相关的测试程序
  7. loj#2143. 「SHOI2017」组合数问题
  8. LeetCode 1177. 构建回文串检测(前缀和)
  9. html把图片定位在盒子中心,html – CSS在图像的右上角定位一个图标
  10. 字符串_KMP算法(求next[]模板 hdu 1711)
  11. python deap_遗传算法库DEAP的示例代码的学习和分析
  12. TeamViewer远程控制软件,让你享受远程办公的便利
  13. STM32F10x_StdPeriph_Template
  14. 开发板的lcd 显示
  15. 二维码活码源码(含数据库脚本)
  16. 作为一个程序员应该看的书籍
  17. 2022icpc昆明
  18. 「Adobe国际认证」设计小白必须了解的色彩理论,绝对干货满满
  19. 给所有想爱、正在爱、失去爱的人(转)
  20. 计算机有60进制吗,60进制介绍

热门文章

  1. 人工智能和Adobe Sensei
  2. php 批量修改mysql 数据表,字段 字符集编码
  3. Silverlight之工具箱使用1
  4. Android选项切换条SHSegmentControl
  5. jqurey操作radio总结
  6. python 中的yum pip
  7. C++语言基本概念(5)
  8. 基于.NET2.0的System.Net.Mail发送邮件Demo
  9. luogu4389 付公主的背包
  10. Linux系统运维之路