Codeforces Round #105 (Div. 2) C. Terse princess

统信UOS V20 安装mysql5.7.42详细教程 到bin/下,执行下面的命令,初始化mysql服务信息,得到数据库的初始密码,实际如果目录不一样记得换成自己的目录。下载后通过远程将安装包上传至服务器,我这里将安装包上传至/usr/local/mysql 下。ps:这时候如果还是不能远程访问的话,可能是防火墙的原因,命令行执行以下命令即可。再次登录,发现缺少 libtinfo.so.5文件,再次建立软连接。登录,发现报错,提示缺少libncurses.so.5文件,使用。创建 /var/lib/ 下mysql目录。登录成功,修改密码,设置远程访问。 阅读详情

C. Terse princess
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

«Next please», — the princess called and cast an estimating glance at the next groom.

The princess intends to choose the most worthy groom, this is, the richest one. Whenever she sees a groom who is more rich than each of the previous ones, she says a measured «Oh...». Whenever the groom is richer than all previous ones added together, she exclaims «Wow!» (no «Oh...» in this case). At the sight of the first groom the princess stays calm and says nothing.

The fortune of each groom is described with an integer between 1 and 50000. You know that during the day the princess sawn grooms, said «Oh...» exactly a times and exclaimed «Wow!» exactly b times. Your task is to output a sequence ofn integers t1, t2, ..., tn, whereti describes the fortune ofi-th groom. If several sequences are possible, output any of them. If no sequence exists that would satisfy all the requirements, output a single number-1.

Input

The only line of input data contains three integer numbers n, a and b (1 ≤ n ≤ 100, 0 ≤ a, b ≤ 15, n > a + b), separated with single spaces.

Output

Output any sequence of integers t1, t2, ..., tn, whereti (1 ≤ ti ≤ 50000) is the fortune ofi-th groom, that satisfies the given constraints. If no sequence exists that would satisfy all the requirements, output a single number-1.

Sample test(s)
Input
10 2 3
Output
5 1 3 6 16 35 46 4 200 99
Input
5 0 0
Output
10 10 6 6 5
Note

Let's have a closer look at the answer for the first sample test.

  • The princess said «Oh...» (highlighted in bold): 5 1 3 6 16 35 46 4 200 99.
  • The princess exclaimed «Wow!» (highlighted in bold): 5 1 3 6 16 35 46 4 200 99.

题目链接:http://codeforces.com/problemset/problem/148/C

题目大意:n个数的数组,如果当前数字比它前面所有的数字都大,则是情况Oh,情况Oh的数有a个。如果这个数比它前面所有数字的和都大,则是情况Wow,情况Wow的数有b个。构造这样的数组。如果数组不存在,输出-1。

解题思路:二进制思维处理Wow的情况,1 2 4 8 16......每个数都比前面的数字和大,先构造Wow的情况,再构造Oh的情况,最后构造一般情况。注意:1.b=0且普通情况只有一个时不能构造;2.第一个数是普通情况;3.Wow,Oh条件都满足时时Wow情况。


代码如下:

#include <cstdio>
#include <cstring>
int t[105];
int main(void)
{
	int n,a,b;
	scanf("%d%d%d",&n,&a,&b);
	if(!b&&a&&n-a==1)
	{
		printf("-1\n");
		return 0;
	}
	printf("1");
	t[0]=1;
	for(int i=1;i<n;i++)
	{
		if(!b&&i==1)
		{
			t[1]=1;
			printf(" 1");
			a++;
			continue;
		}
		if(i<=b)
			t[i]=1<<i;
		else if(i<=a+b)
			t[i]=t[i-1]+1;
		else
			t[i]=t[i-1];
		printf(" %d",t[i] );
	}
	printf("\n");
}



ImportError: DLL load failed while importing _pydantic_core: 找不到指定的程序对应解决方案 本文主要介绍了ImportError: DLL load failed while importing _pydantic_core: 找不到指定的程序对应解决方案,希望能对使用Python的同学们有所帮助。 文章目录 1. 问题描述 2. 解决方案 阅读详情

相关推荐

GB28181安防平台未授权访问漏洞:原理、复现与修复指南

未授权访问漏洞是Web安全中常见的访问控制缺陷,其本质在于应用在提供对敏感功能或数据的访问前,未能对请求者的身份和权限进行充分验证。从技术原理上看,这类漏洞常源于拦截器配置错误、安全注解遗漏或自定义校验逻辑缺陷,导致本应受保护的API接口被意外暴露。在工程实践中,此类漏洞危害巨大,攻击者无需登录即可直接访问系统核心接口,可能引发敏感信息泄露、权限提升甚至系统接管。尤其在安防监控、物联网管理平台等场景中,一旦涉及用户管理接口(如`/api/user/**`),风险会急剧放大。本文以GB28181视频监控管理平

weixin_30271335的博客 436

codeforces 148 C. Terse princess(思维,构造)

C. Terse princess(思维,构造) 题目链接:codeforces 148C 题意: 有个公主找王子,如果这个人比之前所有王子的财富都高,公主就会Oh, 如果这个人比之前所有的财富值的总和加起来还多,就会WOW,(WOW的时候不会Oh) 有n个人 a 次Oh,b 次WOW。 输出一个序列满足a...

error311的博客 323

一步一步教你写股票走势图——K线图一(概述)

股票分时图部分已经开发完毕,受到了广大开发者的好评!界面、功能都挺完美,解决了好一些MP开发者的问题,博主甚是欣悦,更有动力去开源K线图。这里说一下,如果有问题直接留言或者发邮件,github上个人信息有邮件,我看到基本都会回复,博主不加qq的,体谅O(∩_∩)O。分析好了,废话不多说,我们分析下K线图吧,首先我们看下自选股K线图的效果吧效果还是很赞的,经过分时图的研究后,博主越来越确信自选股用的应

体验Android编程之美 3万+

CodeForces - 148C Terse princess (构造)

题目链接:http://codeforces.com/problemset/problem/148/C点击打开链接 C. Terse princess time limit per test 1 second memory limit per test 256 megabytes input standard input

xuejye的博客 310

单片机毕业设计-基于STM32单片机的智能镜系统-仿真设计

可通过MQ-2监测当前烟雾浓度可通过温湿度传感器监测当前温湿度可通过光照强度传感器监测光照强度可通过蜂鸣器进行烟雾报警可通过语音识别模块进行反馈播报状态可通过按键设置阈值三个继电器控制灯、加湿、风扇标签:STM32单片机、OLED112864、DHT11、BH1750、继电器、SU-03T、MQ-2、蜂鸣器题目扩展:智能家居安防、智能大棚控制系统、智能环境检测系统项目编号:ZL-32-240604-FZ。

bsdog11的博客 964

WSL基础环境配置方案

通过以上步骤,您已经在 Windows 的 WSL 环境中成功搭建了一个完整的基础开发环境,包含 Docker、Kubernetes、Helm、kubectl、yq、Git 等工具。这套环境特别适用于在国内使用阿里云镜像服务部署和管理 Tekton,提升了开发和运维的效率和稳定性。

落魄书生的职业学习生涯 8876

CodeForces - 148C C - Terse princess 构造数列

«Next please», — the princess called and cast an estimating glance at the next groom. The princess intends to choose the most worthy groom, this is, the richest one. Whenever she sees a groom who is

Marcus-Bao的个人主页 843

C语言实现AES加解密

C语言实现AES加解密 #include<stdio.h> #include<string.h> #include<time.h> #include<windows.h> #define Nb 4 //数据块行数 #define Nk 4 //密码块行数 #define Nr 10 //轮加密次数 unsigned char RoundKey[4*Nb*(Nr+1)]; //轮密钥 unsigned char Key[17];

qq_44310495的博客 8889

C. Terse princess

题意:有个公主找王子,如果这个人比之前所有王子的财富都高,公主就Oh,如果这个人比之前所有的财富值的总和加起来还多,就WOW,有n个人a次Oh,b次WOW。输出一个序列满足a,b,如果没有就输出-1. 思路:这题需要数列是从小到大,比较坑的就是,如果序列是1 2 3 4的话,1是2的两倍是Oh还是WOW呢。这一点其实我也不是很理解。我就优先处理b的数值,再处理a,如果最后a||b的话就输出-1,...

JTY的博客 436

MT6816磁编码器在无人机电调中的实战应用:从选型到调试全记录

本文详细介绍了MT6816磁编码器在无人机电调系统中的实战应用,涵盖选型、硬件集成、软件配置到飞行测试的全流程。通过对比霍尔传感器和光电编码器,突出MT6816在角度分辨率、安装公差和抗振动能力等方面的优势,为无人机动力系统提供高精度控制解决方案。

pandas7gardener的博客 232

Thor芯片部署

英伟达Jetson Thor芯片性能分析与应用现状 摘要:英伟达最新发布的Jetson Thor芯片基于Blackwell架构,官方宣称AI算力达2070TFLOPS(FP4),较前代Orin提升7.5倍,配备14核Arm CPU和128GB内存。然而实际量产版算力缩水至700TOPS,且因4nm制程良率问题多次延期至2025-2026年交付。该芯片支持FP4/FP8量化、Transformer引擎等先进特性,适用于自动驾驶、机器人等边缘AI场景,但受供应链限制,国内厂商倾向自研方案。开发者可通过JetPa

xiaomu_347的博客 429

codeforces-148C-Terse princess【构造】

148C-Terse princess

Linoy 1037

[QMT量化交易小白入门]-三十四、让deepseek分析北京炒家的首板策略后,在打板前增加了选股范围(量化python代码解析)

print(f'开始盘前选股')这行代码定义了一个名为的函数,当调用这个函数时,会首先打印出“开始盘前选股”的信息,表明选股流程正式启动。1、可根据情况增删部分条件,目前盘前选股目前可以选出140多支,比之前全市场监听带宽压力小了很多。2、还可以自行添加其他选股条件,比如换手率计算,炸板可能性检测。3、xtdata的数据是有可能缺失的,自己写策略时,有可能需要剔除,或者从第三方库校正,比如部分股票的流通股数。

木头大左的博客 2693

Codeforces Round #105 (Div. 2) 148C Terse princess(脑洞)

C. Terse princess time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output «Next please», — the princess called and c

GKHack's Blog 1166

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

codeforces 148C Terse princess(有意思的模拟)

«Next please», — the princess called and cast an estimating glance at the next groom. The princess intends to choose the most worthy groom, this is, the richest one. Whenever she sees a groom who is more rich than each of the previous ones, she says a meas

HJY 402

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

Codeforces Round #105 (Div. 2) (ABCDE题解)

Codeforces Round #105 (Div. 2) (ABCDE题解)

Tc的专栏 2278

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

CodeForces 148C - Terse princess

C. Terse princess time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output «Next please», — the princess called and

coco430的专栏 765

B - Terse princess

B - Terse princess «Next please», — the princess called and cast an estimating glance at the next groom. The princess intends to choose the most worthy groom, this is, the richest one. Whenever she se...

king9666的博客 213

CodeForces 148C Terse princess(这个题也是个坑...)

C. Terse princess time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output «Next please», — the princess called and c

Sirius_han的博客 377

codeforces 538 B.Quasi Binary(思维题)

B. Quasi Binary time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A number is called quasibinary if its decim

ysCover 1702

The 2014 ACM-ICPC Asia Regional Contest Xi'an Site K ast Defence

ProblemK. Last Defence Description Given two integersA and B. Sequence S is defined as follow: • S0 = A • S1 = B • Si = |Si−1 −Si−2| for i ≥ 2 Count the number ofdistinct numbe

ysCover 1131

CSU 1217 奇数个的那个数(异或)

1217: 奇数个的那个数 Time Limit: 2 Sec  Memory Limit: 1 MB Submit: 523  Solved: 120 [Submit][Status][Web Board] Description 给定些数字,这些数中只有一个数出现了奇数次,找出这个数。 Input 每组数据第一行n表示数字个数,1 接下来n行每行一个32位

ysCover 1111

Codeforces Beta Round #34 (Div. 2) C. Page Numbers

C. Page Numbers time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output «Bersoft» company is working on a new version of its

ysCover 1047

Codeforces Round #105 (Div. 2) B. Escape

B. Escape time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output The princess is going to escape the dragon's cave, and she

ysCover 1010

Codeforces Round #313 (Div. 2) C. Gerald's Hexagon(补大三角形)

C. Gerald's Hexagon time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Gerald got a very curious hexagon for his birthda

ysCover 1010

poj 2945 Find the Clones (map+string,hash思维)

Find the Clones Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 7498   Accepted: 2780 Description Doubleville, a small town in Texas, was attacked by the ali

ysCover 928
上一篇: hdu 1698 Just a Hook (线段树区间更新裸题)
下一篇: CSU 1601 War (并查集)
雨狮子
博客等级 码龄12年 24粉丝 185原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值