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. Leetcode--easy系列4

    #58 Length of Last Word Given a string s consists of upper/lower-case alphabets and empty space char ...

  2. Android之怎样改变焦点状态【EditText】

    以EditText为例 1.改变焦点状态 password.setOnFocusChangeListener(new OnFocusChangeListener() { @Override publi ...

  3. swift语言点评二

    一.数据类型 1.基础类型的封装 Swift provides its own versions of all fundamental C and Objective-C types, includi ...

  4. ActiveMQ学习笔记(6)----ActiveMQ整合Spring开发

    1. 添加依赖 spring 提供了对JMS的支持,需要添加Spring支持jms的包和Spring的核心包,如下: <dependency> <groupId>org.apa ...

  5. li自定义图标

    /*自定义list的图标*/ li{ list-style-image: url(../img/21.JPG); }

  6. Flux架构与Redux简介

    Flux架构区别于传统的MVC架构 在facebook实践中, 当用户接收到新消息时,右上角会弹出你有一条新消息, 右下角的对话框也会提示有新消息, 如果用户在对话框中查看了新消息,那么右上角的这个新 ...

  7. du -sh*查看当前目录下的文件夹大小

    du -sh*查看当前目录下的文件夹大小   u 命令    用途    概述磁盘使用.    语法  du [ -a | -s ] [ -k ] [ -m ] [ -g ][ -l ] [ -r ] ...

  8. textarea统计字数

    开发项目中经常会用到,textarea统计字数 源码如下: <!DOCTYPE html><html lang="en"><head> < ...

  9. docker-ce-17.03.2 离线安装RPM包

    [root@docker05 docker]# ll total 20796 -rw-r--r-- 1 root root    75032 Mar 26 23:52 audit-libs-pytho ...

  10. 关于Subversion主从备份方式的调整(全量、增量脚本)更新

    本文引用于http://blog.chinaunix.net/uid-25266990-id-3369172.html 之前对Subversion服务器作了迁移,关于SVN的架构也走了调整,有单一的服 ...