NBUT Minecraft Server Bug

  • 问题描述
  • 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;
}

NBUT Minecraft Server Bug

时间: 2024-10-13 03:12:27

NBUT Minecraft Server Bug的相关文章

疑难杂症--SQL SERVER 2012下数据库内存异常回收

--=================================================================== --背景: 在一台SQL SERVER 2012 SP1(11.0.3000)服务器上,由于批处理请求较高,CPU使用率超过40%,于是开始各种调研.. 服务器情况: 服务器物理内存为128GB, 分配给SQL SERVER 115GB,Windows 可用物理内存为6GB左右 压力情况: 批处理请求超过30000+,有大量UPDATE和INSERT操作,C

開設Spigot Minecraft伺服器

指令 作用 /help [頁數] 顯示幫助 /gamemode [0/1/2] 調整游戲模式 /op [玩家名稱] 將 [玩家名稱] 設定為管理員 /deop [玩家名稱] 取消 [玩家名稱] 的管理員權限 /kick [玩家名稱] 將 [玩家名稱] 踢出伺服器 /ban [玩家名稱] 封禁 [玩家名稱] /pardon [玩家名稱] 取消 [玩家名稱] 的封禁 /say [內容] 從命令端給對全體玩家內說 [內容] /tell [玩家名稱] [內容] 給 [玩家名稱] 私聊 [內容] /sto

如何在Fedora 26上安装Minecraft 服务器

在本教程中,我将指导您在Vultr的高性能SSD VPS上建立一个Minecraft服务器.您将学习如何在Fedora 26 x64上设置Minecraft服务器. 要求 SSH客户机. 1GB RAM VPS服务器,安装Fedora 26 x64. 准备 首先,登录到位于Vultr的新Fedora服务器并安装所需的软件. ssh [email protected] 安装Java 1.8: [[email protected] ~]# yum install java-1.8.0-openjdk

nternal Exception java.net.socketexception Connection Reset Error : A Guide

Copy from http://www.minecraftman.com/internal-exception-java-net-socketexception-connection-reset/ Internal Exception java.net.socketexception Connection Reset Error : A Guide The Internal Exception java.net.socketexception Connection Reset error me

好烦,水题花了那么长时间还做不出来,然后。。。。就没有然后了。。。。

h 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 explod

当 NSDictionary 遇见 nil

Demo project: NSDictionary-NilSafe 问题 相信用 Objective-C 开发 iOS 应用的人对下面的 crash 不会陌生: *** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[1] *** setObjectForKey: key cannot be nil *** setObjectForKey

personal log: make my own media center

rcd my own path , on building my own media center. Use ffserver ,ffmpeg;  May not be helpful for u . It's nothing the bugs i'v meet & tasks I'v made. ------------------------------------------CONTENT---------------------------------------------------

C# Driver LINQ Tutorial

1.介绍 该教程涵盖了1.8版本的C#驱动中的LINQ查询.你可能已经阅读最新的C# Driver Tutorial. 2.快速开始 首先,给程序添加下面的using声明 using MongoDB.Driver.Linq; 然后,像往常一样,获取一个collection的引用变量: var collection = database.GetCollection<TDocument>("collectionname"); 写LINQ查询背后的基本思路,是从一个集合变量开始,

Jmeter3.0新特性

2016-5-19昨日,Jmeter又更新了新版本. 那么新版本有哪些新特性呢? Changes This page details the changes made in the current version only. Earlier changes are detailed in the History of Previous Changes. Version 3.0 Summary New and Noteworthy Known bugs Incompatible changes B