蒟蒻爆零求助
查看原帖
蒟蒻爆零求助
593403
PanDaoxi楼主2022/11/8 21:48
// Author: PanDaoxi
#include <bits/stdc++.h>
#define int long long
using namespace std;

const int INF = 101;
string a, s, tempNumber;
char c;
int len;

int stoi(string &t){
	int k = 0, tlen = t.size();
	for(int i=0; i<tlen; i++){
		k = k*10 + (t[i] - '0');
	}
	return k;
}

signed main(){
	ios :: sync_with_stdio(false);
	
	cin >> a;
	len = a.size();
	
	for(int i=0; i<len; i++){
		if('0' <= a[i] && a[i] <= '9'){
			tempNumber += a[i];
		}
		else{
			if(a[i] != c){
				for(int j=1; j<=stoi(tempNumber); j++){
					s += c;
				}
				c = a[i];
				s += a[i];
				tempNumber = "";
			}
			else{
				s += c;
				tempNumber = "";
				c = a[i];
			}
		}
	}
	cout << s+c;

	return 0;
}
2022/11/8 21:48
加载中...