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 ...
随机推荐
- typescript学习笔记(一)---基础变量类型
作为一个前端开发者,学习新技术跟紧大趋势是必不可少的.随着2019年TS的大火,我打算利用一个月的时间学习这门语言.接下来的几篇文章是我学习TS的学习笔记,其中也会掺杂一些学习心得.话不多说,先从基础 ...
- ForkJoin统计文件夹中包含关键词的数量
2018-06-09总结: ForkJoin确实可以很快速的去解析文件并统计关键词的数量,但是如果文件过大就会出现内存溢出,是否可以通过虚拟内存方式解决内存溢出的问题呢? package com.ox ...
- restframewor 版本(version)
1.路由 a.一级路由 from django.contrib import admin from django.urls import path, include from api import u ...
- Docker windows nanoserver/mysql镜像root用户密码错误
由于需要在Windows server上的Docker中部署mysql服务,为了方便起见所以在Docker hub找到了nanoserver/mysql (https://hub.docker.com ...
- 你可能不知道的 Python 技巧
英文 | Python Tips and Trick, You Haven't Already Seen 原作 | Martin Heinz (https://martinheinz.dev) 译者 ...
- 创建过滤扩展方法 Creating Filtering Extension Methods 精通ASP-NET-MVC-5-弗瑞曼 Listing 4-17
- POJ Expanding Rods
点击打开题目 题目大意 给定L,n,C,L为红色线段,L(1+n*C)为绿色弧,求两者中点的距离 二分圆心角度数,接下来就是几何的能力了 根据正弦定理,可得: Lsinθ=rsin(90°−θ) 则弧 ...
- Liunx创建到部署ASP.NET Core项目从零开始-----使用Centos7
一.搭建环境 1..注册Microsoft密钥和源 执行命令:sudo rpm -Uvh https://packages.microsoft.com/config/centos/7/packages ...
- Python单元测试unittest测试框架
本文的主题是自动化测试框架的实现,在实现之前,先了解一下关于unittest模块的相关知识: Python中有一个自带的单元测试框架是unittest模块,用它来做单元测试,它里面封装好了一些校验返回 ...
- sharding-JDBC学习笔记
sharding-JDBC学习笔记 ShardingSphere ShardingSphere是一套开源的分布式数据库中间件解决方案组成的生态圈,它由Sharding-JDBC.Sharding-Pr ...