标签:des style class blog code ext
越野跑
样例输出
3
这一定是道水题::
#include<iostream> using namespace std; int main() { int m,t,u,f,d,i,v1,v2,s,ans; char a[100000]; cin>>m>>t>>u>>f>>d; for (i=1;i<=t;i++) cin>>a[i]; v1=u+d; v2=f+f; s=0;ans=0; while (s<m) { ans+=1; if (a[ans]==‘u‘||a[ans]==‘d‘) s+=v1; else s+=v2; } if (s>m) ans-=1; cout<<ans; return 0; }
测试数据 #1: Accepted, time=0ms, mem=640KB, score=10
测试数据 #2: Accepted, time=0ms, mem=640KB, score=10
测试数据 #3: Accepted, time=0ms, mem=636KB, score=10
测试数据 #4: Accepted, time=0ms, mem=640KB, score=10
测试数据 #5: Accepted, time=0ms, mem=636KB, score=10
测试数据 #6: Accepted, time=0ms, mem=640KB, score=10
测试数据 #7: Accepted, time=0ms, mem=636KB, score=10
测试数据 #8: Accepted, time=0ms, mem=640KB, score=10
测试数据 #9: Accepted, time=0ms, mem=640KB, score=10
测试数据 #10: Accepted, time=0ms, mem=636KB, score=10
Time = 0ms Mem = 640KB Score= 100
tyvjP1003越野跑(水),布布扣,bubuko.com
标签:des style class blog code ext
原文地址:http://www.cnblogs.com/seekdreamer/p/3785477.html