CSP 化学方程式 100分题解

思路分析
这道题的题目较之前有了一些减短,不过还是一样的有些麻烦。基本思路就是检验方程式两边的元素是否已经配平,所以去找元素和其对应的个数就可以了,接下来就是程序设计问题了。
代码

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <stack>

using namespace std;

map<string, int> buff;

struct node {
   
	string c;
	int n;
	node(string cc, int nn) {
   
		c = cc, n = nn;
	}
};
//这里是从后向前找的,因为这样统计元素个数比较方便
void mysplit(string x, int sign) {
   
	int pre = 1, k = 0;
	if (isdigit(x[k])) {
   
		pre = 0;
		while (isdigit(x[k])) {
   
			pre = pre * 10 + x[k] - 48;
			++k;
		}
	}
	string element = "";
	stack
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值