5分钟写完 水水更开心

//By SiriusRen
#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int m,t,u,f,d;
char jy;
int main(){
scanf("%d%d%d%d%d",&m,&t,&u,&f,&d);
for(int i=1;i<=t;i++){
cin>>jy;
if(jy=='f'){
if(m-2*f>=0)m-=2*f;
else {printf("%d\n",i-1);return 0;}
}
if(jy=='d'||jy=='u'){
if(m-u-d>=0)m=m-u-d;
else {printf("%d\n",i-1);return 0;}
}
}
printf("%d\n",t);
}

POJ 3672 水题......的更多相关文章

  1. poj 1269 水题

    题目链接:http://poj.org/problem?id=1269 #include<cstdio> #include<cstring> #include<cmath ...

  2. poj 2245 水题

    求组合数,dfs即可 #include<cstdio> #include<iostream> #include<algorithm> #include<cst ...

  3. poj 1298(水题)

    The Hardest Problem Ever Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 24241   Accept ...

  4. poj 3006水题打素数表

    #include<stdio.h> #include<string.h> #define N 1100000 int isprim[N],prime[N]; void ispr ...

  5. POJ 1488 Tex Quotes --- 水题

    POJ 1488 题目大意:给定一篇文章,将它的左引号转成 ``(1的左边),右引号转成 ''(两个 ' ) 解题思路:水题,设置一个bool变量标记是左引号还是右引号即可 /* POJ 1488 T ...

  6. POJ 水题若干

    POJ 3176 Cow Bowling 链接: http://poj.org/problem?id=3176 这道题可以算是dp入门吧.可以用一个二维数组从下向上来搜索从而得到最大值. 优化之后可以 ...

  7. poj 3080 Blue Jeans(水题 暴搜)

    题目:http://poj.org/problem?id=3080 水题,暴搜 #include <iostream> #include<cstdio> #include< ...

  8. POJ 水题(刷题)进阶

    转载请注明出处:優YoU http://blog.csdn.net/lyy289065406/article/details/6642573 部分解题报告添加新内容,除了原有的"大致题意&q ...

  9. POJ 3984 - 迷宫问题 - [BFS水题]

    题目链接:http://poj.org/problem?id=3984 Description 定义一个二维数组: int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0, ...

随机推荐

  1. linux 磁盘分区,主分区,扩展分区,逻辑分区以sata接口为例

     以sata接口(依据linux内核检測其顺序 sda,sdb...)为例, 1, 硬盘的限制,最多仅仅能设置4个分区(主分区+扩展分区),路径例如以下, /dev/sda1  /dev/sda2 ...

  2. leetCode 72.Edit Distance (编辑距离) 解题思路和方法

    Edit Distance Given two words word1 and word2, find the minimum number of steps required to convert  ...

  3. nova shelve 的使用

    对于云中的资源我们常有例如以下需求 1,用户对临时不使用的VM进行停止操作.以节省费用. 2.对于长时间未使用的VM.管理员想要从hypervisor层面上清除它们从而节省主机资源. 3.但之前的停止 ...

  4. spark学习及环境配置

    http://dblab.xmu.edu.cn/blog/spark/ 厦大数据库实验室博客 总结.分享.收获 实验室主页 首页 大数据 数据库 数据挖掘 其他 子雨大数据之Spark入门教程  林子 ...

  5. m_Orchestrate learning system---二、如何实现验证码自动点击刷新

    m_Orchestrate learning system---二.如何实现验证码自动点击刷新 一.总结 一句话总结:传过去的url带随机数来避免读取缓存 onclick="this.src ...

  6. BZOJ 4636 (动态开节点)线段树

    思路: 偷懒 懒得离散化 搞了个动态开节点的线段树 (其实是一样的--..) 注意会有a=b的情况 要判掉 //By SiriusRen #include <cstdio> #includ ...

  7. quartz.net定时任务框架详解

    C#做定时任务:一是Timer:而是Quartz.net:本文就学习一下Quartz.net框架 Quartz.net非常的灵活,开发人员能用很少的代码就能完成“每隔一小时执行”.“每天2点执行”.“ ...

  8. SpringBoot(三) SpringBoot中的日志配置

    SLF4J Spring Boot在所有内部日志中使用Commons Logging,但是默认配置也提供了对常用日志的支持,如:Java Util Logging,Log4J, Log4J2和Logb ...

  9. 中文版 ImageNet Classification with Deep Convolutional Neural Networks

    ImageNet Classification with Deep Convolutional Neural Networks 摘要 我们训练了一个大型深度卷积神经网络来将ImageNet LSVRC ...

  10. HDU 1166 敌兵布阵【线段树 单点更新】

    题意:给出n个数,a1,a2,a3,,,,,an,再给出一些操作 add i  j 表示给第i个节点增加j sub i  j 表示给第i个节点减少j query i j 表示询问第i个节点到第j个节点 ...