Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

h好水啊 直接加起来 计数啊

Posted by uncleD at 2019-09-03 18:39:14 on Problem 3672
// poj3672.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//

#include <iostream>
#include <stdio.h>
#include <string>

using namespace std;

char rout[100005];

int main()
{
	int m, t, u, f, d;
	int index = 0;
	int sumT = 0;

	cin >> m >> t >> u >> f >> d;

	for (int i = 0; i < t; i++)
		cin >> rout[i];

	for (int i = 0; i < t; i++)
	{
		if (rout[i] == 'u' || rout[i]=='d')
		{
			sumT += u + d;
			index++;
		}
		else if (rout[i] == 'f')
		{
			sumT += 2*f;
			index++;
		}

		if (sumT > m)
		{
			index--;
			break;
		}
	}

	cout << index << endl;

	return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator