acm hnu 10039 Magician (easy)

这篇博客详细介绍了参与ACM HNU 10039 'Magician'问题的解题过程,包括理解题目要求、算法设计、实现和测试。博主分享了使用随机数生成和Go语言进行编程的心得,并强调了输出格式和每个测试用例的重要性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Magician
Time Limit: 1000ms, Special Time Limit:2500ms, Memory Limit:32768KB
Total submit users: 157, Accepted users: 151
Problem 10039 : No special judgement
Problem description
Denis Mednoepole is a famous magician. For example, he can read spectators' minds and tell the random number that a spectator has got by means of Denis's magic machine. Any spectator can check this: he or she just rotates the wheel of the machine and looks at the 10-digit number that has appeared in the window of the machine. Within two seconds Denis will read the spectator's mind and tell the number. You must write a program that will tell this number even faster - within one second. You need to know that the magic machine has a wheel with N digits written along the edge of the wheel without spaces between them. All digits are of the same width. The window is 10 digits wide, so it shows 10 successive digits. Each time the wheel turns "one digit" an audible click is produced. So you know how many clicks Denis Mednoepole heard while the spectator was rotating the wheel.

Input
There wil be several test cases. For each test case, the first line contains two integers separated with a space, N and M. Here N (11 ≤ N ≤ 1000) is the number of the digits written on the wheel
### 本地部署 DeepSeek R1 训练教程和配置说明 #### 配置环境准备 为了能够在本地环境中顺利训练DeepSeek R1模型,确保计算机满足最低硬件要求是非常重要的。通常建议至少配备有高性能CPU或GPU支持、充足的RAM以及足够的存储空间来处理大型数据集和模型参数文件[^1]。 对于操作系统的选择上,虽然提及了Windows的成功案例,Linux系统因其更好的稳定性和社区支持,在机器学习领域更为常用。如果决定采用Linux作为工作平台,则推荐Ubuntu LTS版本以便获得长期的支持和服务更新。 #### 安装依赖库与工具链 安装必要的软件包是启动任何项目前的关键步骤之一。这包括但不限于Python解释器及其pip包管理工具;用于加速计算过程的CUDA Toolkit(当使用NVIDIA显卡时),cuDNN库等深度学习框架所必需的基础组件;还有像Git这样的版本控制系统可以帮助追踪代码变更历史记录[^2]。 针对特定于DeepSeek R1的需求,可能还需要额外下载并编译一些开源C++/Python扩展模块,这些可以通过阅读官方文档获取最准确的信息指导完成相应操作。 #### 获取预训练权重初始化 考虑到从零开始构建一个高质量的语言模型所需的时间成本极高,利用已有的预训练模型进行微调是一种高效的方法。因此寻找合适的初始权重至关重要——可以考虑联系开发团队询问是否有公开发布的checkpoint可供下载,或是探索其他途径找到相似架构下的优秀成果来进行迁移学习。 #### 数据集整理与标注 有效的监督信号来源于精心设计的数据样本集合。这意味着要收集大量适合目标任务类型的语料资源,并对其进行清洗过滤去除噪声干扰项之后再实施人工或者半自动化的标签分配流程。此部分的工作量往往较大,但却是影响最终效果好坏的重要因素之一。 #### 编写训练脚本及超参调整 编写具体的训练逻辑之前先定义好网络结构描述文件(.json/.yaml),接着基于选定的编程语言实现主要算法函数体内的细节控制流图。期间涉及到许多可调节变量比如批次大小(batch size)、迭代次数(epoch number)、优化方法(optimizer choice)等等都需要经过多次实验对比才能得出最优解组合方案。 ```python import torch from transformers import AutoModelForSequenceClassification, Trainer, TrainingArguments model_name = "path_to_deepseek_r1" data_path = "./dataset/" training_args = TrainingArguments( output_dir='./results', num_train_epochs=3, per_device_train_batch_size=8, per_device_eval_batch_size=8, warmup_steps=500, weight_decay=0.01, ) model = AutoModelForSequenceClassification.from_pretrained(model_name) trainer = Trainer( model=model, args=training_args, train_dataset=data_path + 'train.csv', eval_dataset=data_path + 'test.csv' ) trainer.train() ```
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值