NBUT Minecraft Server Bug

本文探讨了在Minecraft服务器遇到bug时的一种解决方案:利用水桶和岩浆桶混合生成obsidian。特别关注了从前方一排桶中获取水和岩浆的策略,确保在世界末日到来前拯救Minecraft世界。
  • 问题描述
  • Oh Jesus! The Minecraft Server of XadillaX's came across a bug!
    There's one way to solve this bug in game. That is to get a bucket of water and a bucket of lava and mix them to obsidian. But remember, you must get water first, or the server will explode! Boom~


    Fortunately there is a row of buckets at front of Hungar, he can save the world!


    Some of buckets are filled with water and some are lava. Remember that Hungar can only move forward, that means when Hungar move to one bucket, he can't move back to the buckets behind this bucket. And he must get water first.
    Now give you the sort of buckets, please help Hungar to calculate out that how many ways he can save the world.

  • 输入
  • This problem contains several cases because of the XIONG HAI ZI, Minary.
    The first line of each case contains one integer N (0 < N ≤ 1000000) which indicates the number of buckets.
    Next line follows N buckets in from near to far which `W` indicates water and `L` indicates lava.
  • 输出
  • For each case, output the ways Hungar can save the Minecraft world.
  • 样例输入
  • 5W L W L L3W W L
  • 样例输出
  • 52

题意:求先拿W然后才能拿L的方法数

思路:记录L前有多少的W

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int MANX = 1000005;

int n;

int main(){
	while (scanf("%d%*c", &n) != EOF){
		int cnt = 0;
		long long ans = 0;
		int flag = 0;
		char ch;
		for (int i = 0; i < n; i++){
			scanf("%c", &ch);
			getchar();
			if (ch == 'W' && !flag)
				flag = 1;
			if (ch == 'W')
				cnt++;
			if (ch == 'L' && flag)
				ans += cnt;
		}
		cout << ans << endl;
	}
	return 0;
}



## 01、数据介绍 数据整理全国30个省份制造业细分行业产值,能够反映一定时期内细分行业工业生产总规模和总水平的指标,是计算工业生产发展速度和主要比例关系、计算工业产品销售率等其他经济指标的基础。先进制造业数据可用于两业融合测算。 数据名称:全国30省-制造业细分行业产值/先进制造业细分行业产值数据 数据年份:2001-2022年 ## 02、数据指标 农副食品加工业;食品制造业;饮料制造业;烟草制造业;纺织业;纺织服装鞋帽制造业;皮革、毛皮、羽毛(绒)极其制品业;木材加工及木、竹、藤、棕、草制品业;家具制造业;造纸及纸制品业;印刷业和记录媒介的复制;文教体育用品制造业;石油加工、炼焦及核燃料加工业化;学原料及化学制品制造业;医药制造业;化学纤维制造业;橡胶和塑料制品制品业;非金属矿物制品业;黑色金属冶炼及压延加工业;有色金属冶炼及压延加工业;金属制品业;通用设备制造业;专用设备制造业;汽车制造业;其他运输设备制造业;电气机械及器材制造业;通信设备计算机及其他电子设备制造业;仪器仪表及文化、办公用机械制造业;其他制造业;废弃资源和废旧材料回收加工业;制造业总产值 印刷业和记录媒介的复制;石油加工、炼焦及核燃料加工业;化学原料及化学制品制造业;医药制造业;橡胶和塑料制品制品业;非金属矿物制品业;黑色金属冶炼及压延加工业;有色金属冶炼及压延加工业;金属制品业;通用设备制造业;专用设备制造业;汽车制造业;其他运输设备制造业;电气机械及器材制造业;通信设备计算机及其他电子设备制造业;仪器仪表及文化、办公用机械制造业;废弃资源和废旧材料回收加工业
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值