CodeForces 327B 水题。
Time Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u
Description
Iahub and Iahubina went to a date at a luxury restaurant. Everything went fine until paying for the food. Instead of money, the waiter wants Iahub to write a Hungry sequence consisting of n integers.
A sequence a1, a2, ..., an, consisting of n integers, is Hungry if and only if:
- Its elements are in increasing order. That is an inequality ai < aj holds for any two indices i, j (i < j).
- For any two indices i and j (i < j), aj must not be divisible by ai.
Iahub is in trouble, so he asks you for help. Find a Hungry sequence with n elements.
Input
The input contains a single integer: n (1 ≤ n ≤ 105).
Output
Output a line that contains n space-separated integers a1 a2, ..., an (1 ≤ ai ≤ 107), representing a possible Hungry sequence. Note, that each ai must not be greater than 10000000 (107) and less than 1.
If there are multiple solutions you can output any one.
Sample Input
3
2 9 15
5
11 14 20 27 31 思路:本来想打素数表, 但不能超过十的七次方应该就是卡素数吧, 直接把数让他从最大开始然后需要多少连续输出多少,最多十的五次方个数, 但最大十的七次方, 这中间肯定不会出现整除的。 代码:
#include<stdio.h>
#include<string.h>
#include<math.h>
#define N 10000000
int main(void)
{
int i, n;
while(scanf("%d", &n) != EOF)
{
for(i = N - n + 1; i <= N; i++)
{
if(i == N)
printf("%d\n", i);
else
{
printf("%d ", i);
}
}
}
return 0;
}
CodeForces 327B 水题。的更多相关文章
- Pearls in a Row CodeForces 620C 水题
题目:http://codeforces.com/problemset/problem/620/C 文章末有一些测试数据仅供参考 题目大意 给你一个数字串,然后将分成几个部分,要求每个部分中必须有一对 ...
- 【Codeforces自我陶醉水题篇~】(差17C code....)
Codeforces17A 题意: 有一种素数会等于两个相邻的素数相加 如果在2~n的范围内有至少k个这样的素数,就YES,否则就NO; 思路: 采用直接打表,后面判断一下就好了.那个预处理素数表还是 ...
- Codeforces - 631B 水题
注意到R和C只与最后一个状态有关 /*H E A D*/ struct node2{ int kind,las,val,pos; node2(){} node2(int k,int l,int v,i ...
- 水题 Codeforces Round #302 (Div. 2) A Set of Strings
题目传送门 /* 题意:一个字符串分割成k段,每段开头字母不相同 水题:记录每个字母出现的次数,每一次分割把首字母的次数降为0,最后一段直接全部输出 */ #include <cstdio> ...
- 水题 Codeforces Round #300 A Cutting Banner
题目传送门 /* 水题:一开始看错题意,以为是任意切割,DFS来做:结果只是在中间切出一段来 判断是否余下的是 "CODEFORCES" :) */ #include <cs ...
- Codeforces Testing Round #8 B. Sheldon and Ice Pieces 水题
题目链接:http://codeforces.com/problemset/problem/328/B 水题~ #include <cstdio> #include <cstdlib ...
- Codeforces Round #356 (Div. 2)B. Bear and Finding Criminals(水题)
B. Bear and Finding Criminals time limit per test 2 seconds memory limit per test 256 megabytes inpu ...
- Codeforces Round #368 (Div. 2) A. Brain's Photos (水题)
Brain's Photos 题目链接: http://codeforces.com/contest/707/problem/A Description Small, but very brave, ...
- Educational Codeforces Round 7 B. The Time 水题
B. The Time 题目连接: http://www.codeforces.com/contest/622/problem/B Description You are given the curr ...
随机推荐
- wtforms 钩子函数
参考: https://www.cnblogs.com/wupeiqi/articles/8202357.html class LoginForm(Form): name = simple.Strin ...
- [状压DP思路妙题]图
源自 luhong 大爷的 FJ 省冬令营模拟赛题 Statement 给定一个 \(n\) 个点 \(m\) 条边的图,没有重边与自环 每条边的两端点编号之差不超过 \(12\) 求选出一个非空点集 ...
- angular 构建可以动态挂载的配置服务
angular 构建可以动态挂载的配置服务 Intro 在 angular 中可以指定 environment 来区分不同环境下的配置,然而 environment 中的配置会在打包时是固定的,想要像 ...
- [洛谷P1606] [USACO07FEB] 荷叶塘Lilypad Pond
Description 为了让奶牛们娱乐和锻炼,农夫约翰建造了一个美丽的池塘.这个长方形的池子被分成了M行N列个方格(1≤M,N≤30).一些格子是坚固得令人惊讶的莲花,还有一些格子是岩石,其余的只是 ...
- GP工作室—需求分析
团队作业第二次作业--需求分析 问题 答案 这个作业属于哪个课程 软件工程 这个作业要求在哪里 作业要求 团队名称 GP工作室 这个作业的目标 ① 团队项目的需求分析 ②团队项目的原型设计 团队队员介 ...
- Springboot整合Redis入门完整篇,零基础入门教学教程
记录一次简易集成Redis缓存 自定义Redisconfig配置 自定义序列化操作 加深印像 整合前提工具环境准备: 1.redis官网 https://redis.io/download 下载安装r ...
- Redhat6.7 切换Centos yum源
转自:http://inlhx.iteye.com/blog/2336729 RedHat 更换Yum源 1.检查yum包 rpm -qa |grep yum 2.删除自带包 rpm -aq | gr ...
- postman的简单介绍及运用
postman下载地址 https://www.getpostman.com/downloads/ postman的工作原理:发送请求给服务器,服务器处理postman发送的数据然后返回给postma ...
- Xmind8 Pro 破解教程(序列号|破解文件)
最近需要打开文件后缀名为.xmind的文件,所以下载了Xmind8 .打开以后想要导出,奈何普通版本只能导出.txt文本文档,所以只好动手pj.话不多说看下边.一.下载XMindCrack.jar文件 ...
- Java后端开发工程师是否该转大数据开发?
撰写我对java后端开发工程师选择方向的想法,写给在java后端选择转方向的人 背景 看到一些java开发工程师,对java后端薪酬太悲观了.认为换去大数据领域就会高工资.觉得java后端没有前途.我 ...