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

考察题目理解

Posted by sand_and_water at 2024-07-22 19:13:17 on Problem 3672
#include <iostream>
#include <string>
using namespace std;

int main(){
	int m, t, u, f, d, xp;
	int ansr = 0, anst = 0;
	cin >> m >> t >> u >> f >> d;
	f += f;
	xp = u + d;
	char x;
	for(int i = 1; i <= t && anst <= m; ++i){
		cin >> x;
		if(x == 'u'){
			++ansr;
			anst += xp;
		}
		else if(x == 'f'){
			++ansr;
			anst += f;
		}
		else{
			++ansr;
			anst += xp;
		}
	}
	
	cout << ansr - 1 << 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