题意:

外祖母要卖苹果,(有很多但不知道数量),最终所有苹果都卖光了!
有n个人买苹果,如果那个人是half,他就买所有苹果的一半,如果那个人是halfplus,则他买当前苹果数量的一半,Laura还会送半个苹果!问最多能赚多少钱?
思路:
会后一个人一定是halfplus,否则苹果卖不完,所以最后一个人买的时候已经只剩一个。然后从后往前推。
 #include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<string>
#include<cmath>
#include<vector>
using namespace std;
const int maxn=1e5+;
const double eps=1e-;
const double pi=acos(-);
#define ll long long
int main()
{
ll n,m;
char str[][];
while(~scanf("%I64d%I64d",&n,&m))
{
ll num=;
ll ans=;
for(int i=;i<n;i++)
scanf("%s",str[i]);
for(int i=n-;i>=;i--)
{
if(!strcmp(str[i],"halfplus"))
{
num=(num+0.5)*;
ans+=num/2.0*m;
}
else
{
num=num*;
ans+=num/*m;
}
}
printf("%I64d\n",ans);
}
return ;
}

Educational Codeforces Round 9 -- A - Grandma Laura and Apples的更多相关文章

  1. Educational Codeforces Round 9 A. Grandma Laura and Apples 水题

    A. Grandma Laura and Apples 题目连接: http://www.codeforces.com/contest/632/problem/A Description Grandm ...

  2. [Educational Codeforces Round 16]E. Generate a String

    [Educational Codeforces Round 16]E. Generate a String 试题描述 zscoder wants to generate an input file f ...

  3. [Educational Codeforces Round 16]D. Two Arithmetic Progressions

    [Educational Codeforces Round 16]D. Two Arithmetic Progressions 试题描述 You are given two arithmetic pr ...

  4. [Educational Codeforces Round 16]C. Magic Odd Square

    [Educational Codeforces Round 16]C. Magic Odd Square 试题描述 Find an n × n matrix with different number ...

  5. [Educational Codeforces Round 16]B. Optimal Point on a Line

    [Educational Codeforces Round 16]B. Optimal Point on a Line 试题描述 You are given n points on a line wi ...

  6. [Educational Codeforces Round 16]A. King Moves

    [Educational Codeforces Round 16]A. King Moves 试题描述 The only king stands on the standard chess board ...

  7. Educational Codeforces Round 6 C. Pearls in a Row

    Educational Codeforces Round 6 C. Pearls in a Row 题意:一个3e5范围的序列:要你分成最多数量的子序列,其中子序列必须是只有两个数相同, 其余的数只能 ...

  8. Educational Codeforces Round 9

    Educational Codeforces Round 9 Longest Subsequence 题目描述:给出一个序列,从中抽出若干个数,使它们的公倍数小于等于\(m\),问最多能抽出多少个数, ...

  9. Educational Codeforces Round 37

    Educational Codeforces Round 37 这场有点炸,题目比较水,但只做了3题QAQ.还是实力不够啊! 写下题解算了--(写的比较粗糙,细节或者bug可以私聊2333) A. W ...

随机推荐

  1. PHPCMS 核心代码与 www 分离部署

    为了满足更多用户二次开发的兴趣与爱好,同时,为了更加安全.可以通过修改入口代码的包含方式来让主程序和www程序分开. 先看下面目录结构: (图1) 我们需要将 phpcms 目录和 index.php ...

  2. IE 6/7下自赋值导致 overflow 溢出

    情景是要限制一个textarea的最大输入字数(100字,  这字数限制也太少了点吧,不大气) 由于限制输入后需要允许 回退,全选等功能键,故放弃keyup, keydown组合 选用property ...

  3. 工作流(Workflow)学习---基础知识整理

    工作流定义: 工作流是将一组任务组织起来以完成某个经营过程:定义了任务的触发顺序和触发条件,每个任务可以由一个或多个软件系统完成,也可以由一个或一组人完成,还可以由一个或多个人与软件系统协作完成. 工 ...

  4. typedef和#define的区别

    转自:http://www.cnblogs.com/kerwinshaw/archive/2009/02/02/1382428.html 一.typedef的用法在C/C++语言中,typedef常用 ...

  5. jdbc 连接Oracle informix Mysql

    package com.basicSql; import java.sql.Connection; import java.sql.DriverManager; import java.sql.Res ...

  6. 【已解决】Vmware无法创建虚拟网卡的问题

    最近因为各种需要,要在虚拟机里使用桥接方式连接.但是不管怎么操作,都无法添加虚拟网卡.连续好多天需要用到桥接上网,今儿多方搜索,找到了解决方案. 参考资料:http://tieba.baidu.com ...

  7. Bootstrap简易使用指南

    1.框架 1.1全局样式 使用HTML5的doctype,scaffolding.less中定义全局样式,从2开始使用normalize.css,并使用reset.less进行简化 1.2默认栅格系统 ...

  8. JavaScript 找出数组中重复的元素

    实现检测数组重复元素的功能,需要注意一点的是,多个(2个或2个以上)重复元素,我们只需要挑出一个来就可以了. <!DOCTYPE html> <html> <head&g ...

  9. php smarty 缓存和配置文件的基本使用方法

    smarty高级部分包括缓存机制和配置文件的调用 下面是代码实现: 文件一,配置文件: #全局变量 title="网站主页" content="一个网站的主体部分&quo ...

  10. Lua 笔记

    lua命令: #enter shell lua #excute script file lua xxx.lua lua脚本: #!/usr/local/bin/lua 核心概念: As a exten ...