1092 To Buy or Not to Buy (20 point(s))

Notepad++ 开源文本和代码编辑器 目录 notepad++ 概述与下载 notepad++ 概述与下载 1、notepad++ 是一个免费的、开源的文本和源代码编辑器。用 c++ 编程语言编写的 notepad++ 以精简的功能和简化流程为傲,以创建一个轻便高效的文本记事本程序。在实践中,这意味着高速和可访问的、用户友好的界面。 2、notepad++ 官网地址:https://notepad-plus.en.softonic.com/。推荐从官网进行下载,下载后解压即可使用。 3、工具默认是英文,可以切换语言:settings( 阅读详情

1092 To Buy or Not to Buy (20 point(s))

Eva would like to make a string of beads with her favorite colors so she went to a small shop to buy some beads. There were many colorful strings of beads. However the owner of the shop would only sell the strings in whole pieces. Hence Eva must check whether a string in the shop contains all the beads she needs. She now comes to you for help: if the answer is Yes, please tell her the number of extra beads she has to buy; or if the answer is No, please tell her the number of beads missing from the string.

For the sake of simplicity, let's use the characters in the ranges [0-9], [a-z], and [A-Z] to represent the colors. For example, the 3rd string in Figure 1 is the one that Eva would like to make. Then the 1st string is okay since it contains all the necessary beads with 8 extra ones; yet the 2nd one is not since there is no black bead and one less red bead.

figbuy.jpg

Figure 1

Input Specification:

Each input file contains one test case. Each case gives in two lines the strings of no more than 1000 beads which belong to the shop owner and Eva, respectively.

Output Specification:

For each test case, print your answer in one line. If the answer is Yes, then also output the number of extra beads Eva has to buy; or if the answer is No, then also output the number of beads missing from the string. There must be exactly 1 space between the answer and the number.

Sample Input 1:

ppRYYGrrYBR2258
YrR8RrY

Sample Output 1:

Yes 8

Sample Input 2:

ppRYYGrrYB225
YrR8RrY

Sample Output 2:

No 2

简单题。哈希表求解。

#include<iostream>
#include<string>
using namespace std;
int need[256]={0};
int own[256]={0};
int main(void){
	string s1,s2;cin>>s1>>s2;
	for(int i=0;i<s2.length();i++){
		need[s2[i]]++;
	}
	for(int i=0;i<s1.length();i++){
		own[s1[i]]++;
	}
	bool flag = true;
	int extra = 0;int missing=0;
	for(int i=0;i<256;i++){
		if(own[i]>=need[i]){
			extra += (own[i]-need[i]);
		}
		else{
			missing += (need[i]-own[i]);
			flag = false;
		}
	}
	if(flag) cout<<"Yes "<<extra<<endl;
	else cout<<"No "<<missing<<endl;
	return 0;
}

 

如何在多 GPU 配置上运行 Unsloth:数据并行或模型并行 当工作负载受限于内存(模型或批次无法放入单张显卡)、或受限于计算且计算与通信比率较高时(即每块 GPU 的额外计算量超过同步参数的开销,如在 DDP 中,或超过传递激活值的开销,如在模型并行中),多 GPU 配置才开始显现优势。在松散连接的显卡上(尤其是 PCIe 版本的 H100 或 A100),额外的设备间数据传输会导致性能显著低于单 GPU 运行。让我们厘清概念,明确说明如何通过模型并行(将模型拆分到多个 GPU)或数据并行(在每个 GPU 上复制模型)来跨多 GPU 运行 Unsloth。 阅读详情

相关推荐

大模型选型实战指南|教育行业:108个模型「闭卷考试」实测,这3类应用场景直接抄作业!

教育行业大模型选型必读 1.闭卷考试!独家评测集:用最新K12真题(小学-高中全学科)构建“闭卷考场”,108个模型同台竞技,数据污染率<5%(传统评测集污染率超60%) 2.价格透明对比:40元/M tokens的阿里系模型VS 2元/M tokens的字节系、腾讯系模型,谁更值? 3.四大选型禁区:>60元但得分<75的模型被列入不推荐名单(附避坑清单) 4.核心结论直出:教学核心环节必须用专用模型,90%场景用通用模型可降本50%+

easyllm的博客 1523

Notepad++下载与安装教程

基于强大的编辑组件Scintilla,Notepad ++是用C ++编写的,并使用纯Win32 API和STL来确保更高的执行速度和更小的程序尺寸。通过优化尽可能多的例程而不丢失用户友好性,Notepad ++试图减少世界二氧化碳的排放。当使用较少的CPU功率时,PC可以降低速度并降低功耗,从而实现绿色环境。

qq_44111805的博客 4万+

【iceberg数据一致性】iceberg如何保证高并发数据一致性

那么在高并发的时候,同时操作某张表时是如何运作的呢?其实这里iceberg引用了乐观锁的方法。其实在写入数据的时候是有一个验证的操作的,即在准备写入时会检查原文件和带写入文件的差异,如果存在本次写入数据以外的数据,则代表有其他操作已经更新了原文件,那么本次写入会取消,并重试写入的步骤,知道验证完成,写入完成,如此就保证了数据的一致性,并且也解决了HMS锁的问题。在使用iceberg写数据时,一直弄不清楚为什么iceberg写入快,并且能够保证数据的一致性。今天决定搞清楚这个问题,经过查询和理解,写下来。

你的博客 1045

2024最新最全 Notepad ++ 安装与配置教程(非常详细)从零基础入门到精通,看完这一篇就够了!!!

网络安全行业产业以来,随即新增加了几十个网络安全行业岗位︰网络安全专家、网络安全分析师、安全咨询师、网络安全工程师、安全架构师、安全运维工程师、渗透工程师、信息安全管理员、数据安全工程师、网络安全运营工程师、网络安全应急响应工程师、数据鉴定师、网络安全产品经理、网络安全服务工程师、网络安全培训师、网络安全审计员、威胁情报分析工程师、灾难恢复专业人员、实战攻防专业人员…网上虽然也有很多的学习资源,但基本上都残缺不全的,这是我自己录的网安视频教程,上面路线图的每一个知识点,我都有配套的视频讲解。

weixin_42340783的博客 4万+

拜耳阵列(Bayer Pattern)以及常见彩色滤波矩阵(CFA)

本文介绍了拜耳阵列的工作原理(Bayer Pattern)以及常用的彩色滤波矩阵(CFA)

风一样的男子(quinta)的博客 7122

Etcd教程 — 第三章 Etcd集群动态发现、DNS发现

Etcd教程 — 第三章 Etcd集群动态发现、DNS发现

Mr_XiMu的博客 2825

1092 To Buy or Not to Buy(pass简单方法)

Eva would like to make a string of beads with her favorite colors so she went to a small shop to buy some beads. There were many colorful strings of beads. However the owner of the shop would only sel...

C++养成记 732

YOLO11涨点优化:卷积魔改 | 可变形条带卷积(DSCN),魔改轻量DCNv3二次创新

如何跟YOLO11结合:1)和C3k2创新性结合

①答疑群聊服务;②YOLO大模型知识问答系统;③计算机视觉论文生成智能体; 988

2023最新最全 Notepad ++ 安装与配置教程(非常详细)从零基础入门到精通,看完这一篇就够了!!!

网络安全行业产业以来,随即新增加了几十个网络安全行业岗位︰网络安全专家、网络安全分析师、安全咨询师、网络安全工程师、安全架构师、安全运维工程师、渗透工程师、信息安全管理员、数据安全工程师、网络安全运营工程师、网络安全应急响应工程师、数据鉴定师、网络安全产品经理、网络安全服务工程师、网络安全培训师、网络安全审计员、威胁情报分析工程师、灾难恢复专业人员、实战攻防专业人员…网上虽然也有很多的学习资源,但基本上都残缺不全的,这是我自己录的网安视频教程,上面路线图的每一个知识点,我都有配套的视频讲解。

logic1001的博客 4万+

第一百三十九回 介绍三个BLE包

本章回中主要介绍了Flutter中BLE的概念和操作方法,主要介绍了三个BLE包的功能和差异,以方便大家在BLE操作中选择不同的包。

talk_8的专栏 574

DeepSeek Harness 工程实践与高级特性:从测试到安全的完整指南

AI Agent 能执行命令、读写文件、自主决策,能力越强风险越大——删文件、泄密钥、死循环、竞态条件随时可能发生。本文是 DeepSeek Harness 系列第三篇,深入剖析其工程实践与高级特性:从单元测试到真实 API 冒烟测试的分层策略,拒绝 Mock 依赖、坚持"验证世界而非自我报告";从正交结果、规范化契约到 Dispose 静止的防御式编程铁律;以及跨平台多层进程沙箱、文件系统版本守卫、fail-closed 审批机制、模型编写的工作流引擎与上下文压缩等高级能力。

program哲学 207

1092 To Buy or Not to Buy (20 point(s))

Eva would like to make a string of beads with her favorite colors so she went to a small shop to buy some beads. There were many colorful strings of beads. However the owner of the shop would only sel...

张蔡辉 171

小程序真机调试蓝牙可以使用,线上发布版本蓝牙无法使用

小程序提示请打开蓝牙,微信小程序蓝牙无法连接,小程序真机调试蓝牙可以使用,线上版本蓝牙无法使用,测试环境蓝牙正常,开发环境蓝牙正常,发布后蓝牙无法使用

renkai721的专栏 826

1092 To Buy or Not to Buy (20point(s))

1092 To Buy or Not to Buy (20point(s)) Eva would like to make a string of beads with her favorite colors so she went to a small shop to buy some beads. There were many colorful strings of beads. However the owner of the shop would only sell the strings in

佳迪斯的博客 105

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

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

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

PTA甲级1092 To Buy or Not to Buy (20point(s))

首先,先贴柳神的博客 https://www.liuchuo.net/ 这是地址 想要刷好PTA,强烈推荐柳神的博客,和算法笔记 文章目录题目原文Input Specification:Output Specification:Sample Input 1:Sample Output 1:Sample Input 2:Sample Output 2:生词如下:题目大意代码如下 题目原文 Eva w...

Huangpengyu123的博客 263

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

1092 To Buy or Not to Buy (20 point(s))

#include&lt;iostream&gt; #include&lt;cstdio&gt; #include&lt;string&gt; using namespace std; const int MAXN = 256; int book[MAXN]; int miss; string s; int main() { cin &gt;&gt; s; for(int i = 0; i...

徐伯莱 189

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

1092 To Buy or Not to Buy (20point(s)) - C语言 PAT 甲级

* 利用 ASCII 数组对应珠子的数目

有三只土豆 167

PAT_甲级_1092 To Buy or Not to Buy (20point(s)) (C++)【散列】

目录 1,题目描述 题目大意 2,思路 3,AC代码 4,解题过程 第一搏 第二搏 1,题目描述 Sample Input 1: ppRYYGrrYBR2258 YrR8RrY Sample Output 1: Yes 8 Sample Input 2: ppRYYGrrYB225 YrR8RrY Sample Output 2...

&再见萤火虫&的博客 164

1092 To Buy or Not to Buy (20 分)

Eva would like to make a string of beads with her favorite colors so she went to a small shop to buy some beads. There were many colorful strings of beads. However the owner of the shop would only sel...

_Gray 176

1092 To Buy or Not to Buy (20)(20 分)

1092 To Buy or Not to Buy (20)(20 分) Eva would like to make a string of beads with her favorite colors so she went to a small shop to buy some beads. There were many colorful strings of beads. Howeve...

galesaur_wcy 526

1092. To Buy or Not to Buy (20)解题报告

本代码采用了散列的方法。 #include #include #include void hash(int arr[], char str[]); int main(int argc, char** argv) { int origin[100] = {0}, want[100] = {0}, i, left = 0, more = 0; char str1[1010],

信道者 576

1092. To Buy or Not to Buy (20)

直接建表查询 #include #include #include #include using namespace std; int main(){ string owner, eva; cin >> owner >> eva; unordered_map table; for(auto& c : owner){ if(table.find(c) == table

zhangpiu的专栏 484

1092 To Buy or Not to Buy(20 分)

1092 To Buy or Not to Buy(20 分) Eva would like to make a string of beads with her favorite colors so she went to a small shop to buy some beads. There were many colorful strings of beads. However the...

Cute_jinx的博客 203

1092 To Buy or Not to Buy (20 分)

1092 To Buy or Not to Buy (20 分) Eva would like to make a string of beads with her favorite colors so she went to a small shop to buy some beads. There were many colorful strings of beads. However the...

92377 184
上一篇: 1084 Broken Keyboard (20 point(s))
下一篇: 1058 A+B in Hogwarts (20 point(s))
coderwait
博客等级 码龄9年 20粉丝 210原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值