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 |
考察题目理解#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator