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

不用公网IP!用Ollama+Chatbox搭建家庭AI助手(内网穿透方案对比) 本文详细介绍了如何利用Ollama和Chatbox在家庭局域网中搭建本地AI助手,无需公网IP即可实现内网穿透。通过对比不同穿透方案(如Tailscale、FRP等),提供最优配置建议,帮助用户低成本部署隐私安全的家庭AI系统,适用于智能家居、儿童教育等多种场景。 阅读详情

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 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 saw n grooms, said «Oh...» exactly a times and exclaimed «Wow!» exactly b times. Your task is to output a sequence of n integers t1, t2, ..., tn, where tidescribes the fortune of i-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, where ti (1 ≤ ti ≤ 50000) is the fortune of i-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.


题目链接:点击打开链接

有一个长度为n的序列, 如果一个数比前面的数都大, 则会说Oh, 如果一个数比前面所有数的和都大, 则会说Wow. 现给出Oh数a, Wow数

b, 要求输出一个满足题意的数组, 不存在这样的数组则输出-1.

构造一个数组, a[1] = 1, 进行n - 2次操作, 每一次操作都记录当前值和前面数的和, 优先减少b, 为sum + 1, 否则减少a, 为res + 1.

AC代码:

#include "iostream"
#include "cstdio"
#include "cstring"
#include "algorithm"
#include "queue"
#include "stack"
#include "cmath"
#include "utility"
#include "map"
#include "set"
#include "vector"
#include "list"
#include "string"
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const int MAXN = 105;
int n, a, b, ans[MAXN];
int main(int argc, char const *argv[])
{
	scanf("%d%d%d", &n, &a, &b);
	ans[1] = 1;
	int res = 1, sum = 1;
	for(int i = 2; i <= n; ++i) {
		if(b) {
			res = sum + 1;
			b--;
		}
		else if(a && i > 2) {
			res++;
			a--;
		}
		ans[i] = res;
		sum += res;
	}
	if(a || b) {
		printf("-1\n");
		return 0;
	}
	for(int i = 1; i < n; ++i)
		printf("%d ", ans[i]);
	printf("%d\n", ans[n]);
	return 0;
}



DC-DC电源PCB布局实战:从EMI优化到热管理 本文深入探讨了DC-DC电源PCB布局的核心实战技巧。文章从分析电流环路入手,强调通过优化“黄金三角”布局以最小化环路面积,从而有效抑制EMI并提升效率。详细阐述了功率器件摆放、地线分割、敏感信号布线、电感下方铺铜策略以及热管理设计等关键步骤,为工程师提供了一套从理论到实践的完整布局指南。 阅读详情

相关推荐

Unity工业数据可视化:基于ModbusTCP的实时数据通信实战

本文详细介绍了在Unity中实现工业数据可视化的核心方法,重点讲解了基于ModbusTCP协议与PLC等工业设备进行实时数据通信的实战流程。内容涵盖NModbus库的集成、Modbus Slave模拟器的使用、TCP连接的建立与多线程安全通信、数据读写与解析,以及如何将实时数据驱动3D场景,为构建工业数字孪生与监控系统提供完整解决方案。

ol7890123的博客 555

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的博客 378

Qcom camera hal简介

Qcom camera hal简介

weixin_42136255的博客 7770

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

DPO(Direct Preference Optimization)直接偏好优化

本文介绍了DPO(直接偏好优化)方法,该方法通过简化传统的RLHF(基于人类反馈的强化学习)流程,直接利用人类偏好数据进行模型优化。DPO的核心思想是跳过奖励模型训练和强化学习交互步骤,通过数学推导将优化目标转化为仅与策略概率分布相关的形式。推导表明最优策略与奖励模型之间存在显式关系,从而可以构建直接优化策略的损失函数。与RLHF相比,DPO简化了训练流程,提高了工程实现稳定性,同时保持了同等效果。

TeenLucifer的博客 1956

节卡Jaka Zu APP编程避坑指南:从频繁通讯错误到稳定Socket交互的调试心得

本文详细解析了节卡Jaka Zu APP编程中常见的通讯错误问题,并提供了从基础排查到高级调试的完整解决方案。通过优化网络配置、固件匹配、心跳机制和数据交互规范,开发者可实现稳定的Socket通讯,有效提升工业机器人操控的可靠性。文章特别针对v1.6.7.3版本的典型问题给出了实用调试技巧。

weixin_42639633的博客 325

codeforces-148C-Terse princess【构造】

148C-Terse princess

Linoy 1037

在cadence中进行sdf文件的反标及并进行数模混仿

3.在Main-Include Option Settings-Libraries Files/Directories下面加载上面说到的两个.v文件(综合文件和工艺库器件文件),其他默认点击OK;最近在做一个数模混合电路的流片工作,数字部分综合后会生成一个.sdf(标准延时格式)文件,正常来说应该是要在vcs软件上进行电路延时的反标,但由于我的电路需要信号在数字模块和模拟模块中来回循环多次,因此,打算在cadence中完成sdf文件反标,进行数模混合仿真。1.综合生成的电路网表的.v文件;

WSBHX的博客 3278

CodeForces 148C-Terse princess

题意: 公主辨别宝物,如果当前宝物价值大于所有之前宝物价值总和就会说wow ,如果大于之前任何一个宝物价值就会说oh,  现在有a个oh b个wow 询问宝物出现价值顺序 思路: 为了使最大的尽可能的小,所以要先构造wow ,之后构造oh #include #include #include using namespace std; typedef long long ll; co

GameRoad 354

STM32在六轴机械臂实时控制中的选型与分层架构设计

嵌入式实时控制系统中,微控制器的选型直接决定运动控制精度与系统可靠性。其核心在于匹配确定性中断响应、低延迟外设协同与工业协议栈支持等硬性指标。STM32凭借Cortex-M内核的NVIC调度能力、成熟HAL库及CAN FD/高级定时器等专用外设,在机电一体化场景中成为伺服控制中枢的首选。相比ESP32等通用MCU,STM32在硬实时性、EMC认证生态和工业总线兼容性上具备不可替代优势。本文围绕GTB六轴机械臂项目,详解基于STM32F407的硬件抽象层配置、FreeRTOS任务调度、事件队列解耦及闭环控制数

jupi8的博客 755

飞腾UEFI配置GPIO—飞腾FT2000/4 (D2000/8) GPIO引脚配置及使用

讲解了在飞腾UEFI代码中如何添加GPIO配置相关代码,并以GPIO1_B0—B7为例,将这8个引脚配置为GPIO工作模式并默认输出低电平

qq_30135687的博客 5348

Codeforces Round #105 (Div. 2) C. 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 cast an es

ysCover 855

手把手教你完成YOLOv8分类识别界面搭建,使用Qt6设计YOLOv8分类识别系统,前台系统+后台管理系统开发实战,全网最详细教程

本项目基于YOLOv8分类模型,结合PySide6框架开发了一套图形化分类识别系统,支持图片、视频和摄像头实时检测。系统包含以下功能: 分类识别模块:完成图像/视频目标分类,界面展示检测结果。 用户管理模块:支持登录注册、头像修改、密码重置等功能。 AI问答模块:集成DeepSeek大模型接口,实现流式输出对话。 后台管理系统(第二版新增):管理员可管理用户信息及个人中心。 系统采用MySQL数据库存储用户数据,并提供完整的UI界面与交互逻辑。代码已开源,适用于毕业设计或快速部署场景。

在职AI算法工程师,擅长计算机视觉,YOLO目标检测、分割等,擅长web、pyqt界面可视化,好内容持续更新中,来这里跟大家一起学习,共同进步 826

Codeforces Round #321 (Div. 2) 580C Kefa and Park(dfs)

题目链接: 第一行给你n、m,接下来的一行有n个数,如果为1则代表这个点有cat,接下来的n-1行每行给出x、y,表示x、y相连。问你从1出发 能到达的叶子结点有几个,要求到达叶子结点的路上连续有cat的点不超过m。 a数组保存结点是否含有cat,从1这个点开始dfs,每次dfs对cat数组操作,记录连续的含有cat的点数,回溯时再判断当前结点是否满足 条件,要求结点为叶子

GKHack's Blog 2041

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

Codeforces Round #200 (Div. 2)344E Read Time(二分)

E. Read Time time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Mad scientist Mike does not use slow hard disks

GKHack's Blog 1749

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

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

Codeforces Round #325 (Div. 2) 586ABC题解

题目链接:点击打开链接 A: 给出Alena的课表, 1代表有课, 0代表没课, 2个连续0以上可以回家休息, 问你一天在学校待多久. 直接模拟即可, 可以直接计算1, 101的数目. 我记录了开头的1和结尾的1, 然后减去2个连续0以上的个数就是答案. AC代码: #include "iostream" #include "cstdio" #include "cstring" #

GKHack's Blog 1711

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

Codeforces Round #308 (Div. 2)题解

第二天补的 并不都是自己写的 参考了别人的题解 感觉这次cf题意好懂 就是做起来嘛。。 毕竟我还太弱。。 只为落实 A. Vanya and Table time limit per test 2 seconds memory limit per test 256 megabytes input standard input

GKHack's Blog 1674

Codeforces Round #322 (Div. 2) 581A 581B 581C

581A链接:点击打开链接 给你a只红袜子,b只蓝袜子,问你可以组成多少对颜色不同的袜子以及剩下多少对单色袜子。 小小的脑洞,答案分别为a, b最小值以及a - b绝对值的一半。 AC代码: #include "iostream" #include "cstdio" #include "cstring" #include "algorithm" using na

GKHack's Blog 1665

Codeforces Round #250 (Div. 2) 437C The Child and Toy(脑洞贪心)

C. The Child and Toy time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output On Children's Day, the child got a toy

GKHack's Blog 1627

Codeforces Round #313 (Div. 2) 560D Equivalent Strings(dos)

D. Equivalent Strings time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Today on a lecture about strings Gera

GKHack's Blog 1617

Codeforces Round #315 (Div. 2)569C Primes or Palindromes?(预处理)

C. Primes or Palindromes? time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Rikhail Mubinchik believes that t

GKHack's Blog 1599

Codeforces Round #201 (Div. 2) 347C Alice and Bob(脑洞)

C. Alice and Bob time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output It is so boring in the summer holiday, isn

GKHack's Blog 1584

Manthan, Codefest 16 633C Spy Syndrome 2(dfs + stl)

C. Spy Syndrome 2 time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output After observing the results of Spy Syndro

GKHack's Blog 1574

Codeforces Round #337 (Div. 2) 610D Vika and Segments(线段树)

D. Vika and Segments time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Vika has an infinite sheet of squared

GKHack's Blog 1532

Codeforces Round #250 (Div. 2) 437A The Child and Homework(模拟)

A. The Child and Homework time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Once upon a time a child got a tes

GKHack's Blog 1504

Codeforces Round #315 (Div. 2)569D Symmetric and Transitive(dp)

D. Symmetric and Transitive time limit per test 1.5 seconds memory limit per test 256 megabytes input standard input output standard output Little Johnny has recently le

GKHack's Blog 1502
上一篇: POJ3249 Test for Job(拓扑排序+dp)
下一篇: CSU1256 天朝的单行道(spfa)
GKHack
博客等级 码龄11年 48粉丝 291原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值