Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
h好水啊 直接加起来 计数啊// 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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator