题意:

外祖母要卖苹果,(有很多但不知道数量),最终所有苹果都卖光了!
有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. VB6-表格控件MSHFlexGrid 实用代码

    在vb6中要显示数据虽然有datagrid.msflexgrid.mshflexgrid.vsflexgrid.True dbgrid7.0 可选,不过我在工作中用的最多的还是MSHFlexGrid, ...

  2. RSA算法解析

    RSA算法原理(一) 如果你问我,哪一种算法最重要? 我可能会回答"公钥加密算法". 因为它是计算机通信安全的基石,保证了加密数据不会被破解.你可以想象一下,信用卡交易被破解的后果 ...

  3. Python中使用ElementTree解析xml

    在Python中,ElementTree是我们常用的一个解析XML的模块 1.导入ElementTree模块 from xml.etree import ElementTree as ET 2.初始化 ...

  4. python 下载安装及setuptools应用

    1.首先下载python安装程序,下载地址:https://www.python.org/download/releases/2.7.8/ 如下图: 因为我的机器是32位的就选择了Windows x8 ...

  5. delphi xe5 android iny绿色版+最新SDK/NDK安装方法

    转自: http://bbs.2ccc.com/topic.asp?topicid=438595 首先感谢iny的绿色版,因为我的精简Win7 32位安装原版镜像4.63G过程正常,但是编译出错,后来 ...

  6. 使用ssh公钥实现免密码登录

    使用ssh公钥实现免密码登录 ssh 无密码登录要使用公钥与私钥.linux下可以用用ssh-keygen生成公钥/私钥对,下面我以CentOS为例. 有机器A(10.207.160.34),B(10 ...

  7. ZOJ 2110 Tempter of the Bone(DFS)

    点我看题目 题意 : 一个N×M的迷宫,D是门的位置,门会在第T秒开启,而开启时间小于1秒,问能否在T秒的时候到达门的位置,如果能输出YES,否则NO. 思路 :DFS一下就可以,不过要注意下一终止条 ...

  8. IB_DESIGNABLE的使用

    创建LHQTextField 继承自: UITextField 将我自定义的textField在面板中进行关联 此时,在设置刚来添加的属性的值的时候,就会立马出效果

  9. C内存管理

    一般而言,分配给进程的内存有四个概念上不同的区域,分别为:代码段.数据段.堆和栈,其中数据段又可以细分为初始化为非零的数据和初始化为零的数据.如下图所示: 1.栈区(stack)— 由编译器自动分配释 ...

  10. Handler 接收Parcelable ArrayList时返回空的错误

    遇到一个问题,从handler 接收的Parcelable ArrayList返回空,调试发现这个arraylist生成的时候是有值的,传到handler就没值了 赋值的代码 new Thread(n ...