codeforces 327 B. Hungry Sequence
来源:互联网 发布:多益网络招聘学历要求 编辑:程序博客网 时间:2024/06/04 19:27
题目链接
题目就是让你输出n个数的序列,要保证该序列是递增的,并且第i个数的前面不能保护它的约数,我直接先对前100000的素数打表,然后输出前n个,so easy。
//cf 191 B#include <stdio.h>#include <string.h>int ans[100005];bool vis[10000000];int main(){ int cnt = 1; for (int i = 2; i < 1300000; i++) { if (vis[i]) continue; for (int j = i+i; j < 10000000; j += i) vis[j] = true; if (!vis[i]) ans[cnt++] = i; if (cnt > 100000) { break; } } int n; while (scanf("%d", &n) != EOF) { for (int i = 1; i < n; i++) printf("%d ", ans[i]); printf("%d\n", ans[n]); } return 0;}
- codeforces 327 B. Hungry Sequence
- codeforces 327B. Hungry Sequence
- Codeforces 327B-Hungry Sequence(素数筛)
- CF 327B. Hungry Sequence
- CF 327B Hungry Sequence
- Codeforces#191(Div.2)-B. Hungry Sequence
- B. Hungry Sequence
- codeforces 327B(Hungry Sequence) 素数筛法入门(欧拉筛法) Java
- CF 327B Hungry Sequence 这真的是个小学数学问题。。好水的感觉
- CF_327B Hungry Sequence
- Hungry Sequence(水题)
- Hungry Sequence(水题)
- codeforces 601B Lipshitz Sequence
- Codeforces 601B Lipshitz Sequence
- Codeforces 601B Lipshitz Sequence(高效)
- CodeForces 626A B - Robot Sequence
- Codeforces 743B Chloe and the sequence
- 743B. Chloe and the sequence codeforces
- 黑马程序员 Math对象
- 如何让电脑在待机时不断网呢?
- 简洁高效的LRU Map C++实现
- stm32f407之高级定时器 死区互补PWM(操作寄存器)
- QuickReport Delphi7完全解决方案
- codeforces 327 B. Hungry Sequence
- 对 JavaScript 下 namespace 功能的简单分析
- stm32f407之PWM(操作寄存器)
- 构造函数为什么不能是虚函数
- linux lsof详解
- stm32f407之基本定时器TIM6&TIM7(操作寄存器)
- Sed与AWK入门教程之Sed篇
- javascript中的对象
- 截获UIWebView的Request