Your Ride Is Here

 /*
PROG:ride
LANG:C++
*/
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <queue>
#include <stack>
#include<fstream>
using namespace std;
string s1,s2;
int main()
{
ifstream fin("ride.in");
ofstream fout("ride.out");
while(fin>>s1>>s2)
{
int sum1=,sum2=;
for(int i=;i<s1.length();i++)
sum1=(sum1*(s1[i]-'A'+))%;
for(int i=;i<s2.length();i++)
sum2=(sum2*(s2[i]-'A'+))%;
if(sum1==sum2)
fout<<"GO"<<endl;
else
fout<<"STAY"<<endl;
} return ;
}

ride

Greedy Gift Givers

分析:模拟,开一个map维护名字和对应的收支即可,注意结束条件

 /*
PROG:gift1
LANG:C++
*/
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <queue>
#include <stack>
#include<fstream>
using namespace std;
const int maxn=;
string x[maxn];
typedef pair<int,int> p;
map<string,p> mp;
int main()
{
ifstream fin("gift1.in");
ofstream fout("gift1.out");
int t;
fin>>t;
for(int i=;i<t;i++){
fin>>x[i];
mp[x[i]].first=; //收入
mp[x[i]].second=; //支出
}
int n=t;
while(n--){
string name;
fin>>name;
int money,num;
fin>>money>>num;
if(num==) continue;
int div=money/num;
int mod=money%num;
mp[name].second+=(money-mod);
for(int i=;i<num;i++){
string ch;
fin>>ch;
mp[ch].first+=div;
}
}
for(int i=;i<t;i++){
fout<<x[i]<<" ";
fout<<mp[x[i]].first-mp[x[i]].second<<endl;
}
return ;
}

gift1

Section 1.1的更多相关文章

  1. keil MDK error: L6236E: No section matches selector - no section 错误

    今天板子刚到,新建的第一个工程就报错了. .\Objects\cse.sct(7): error: L6236E: No section matches selector - no section t ...

  2. 【代码笔记】iOS-一个tableView,两个section

    一,效果图. 二,工程图. 三,代码. RootViewController.h #import <UIKit/UIKit.h> @interface RootViewController ...

  3. gcc/linux内核中likely、unlikely和__attribute__(section(""))属性

    查看linux内核源码,你会发现有很多if (likely(""))...及if (unlikely(""))...语句,这些语句其实是编译器的一种优化方式,具 ...

  4. <section> 标签

    最近正在学习html5,刚接触html5,感觉有点不适应,因为有一些标签改变了,特别是div, section article这三个标签,查了一些资料,也试着用html5和css3布局网页,稍微有点头 ...

  5. [ASP.NET MVC 小牛之路]12 - Section、Partial View 和 Child Action

    概括的讲,View中的内容可以分为静态和动态两部分.静态内容一般是html元素,而动态内容指的是在应用程序运行的时候动态创建的内容.给View添加动态内容的方式可归纳为下面几种: Inline cod ...

  6. $\LaTeX$笔记:Section 编号方式(数字、字母、罗马)&计数器计数形式修改

    $\LaTeX$系列根目录: Latex学习笔记-序 IEEE模板中Section的编号是罗马数字,要是改投其他刊物的话可能得用阿拉伯数字,所以可以在导言部分做如下修改(放在导言区宏包调用之后): \ ...

  7. [DOM Event Learning] Section 4 事件分发和DOM事件流

    [DOM Event Learning] Section 4 事件分发和DOM事件流 事件分发机制: event dispatch mechanism. 事件流(event flow)描述了事件对象在 ...

  8. [DOM Event Learning] Section 3 jQuery事件处理基础 on(), off()和one()方法使用

    [DOM Event Learning] Section 3 jQuery事件处理基础 on(),off()和one()方法使用   jQuery提供了简单的方法来向选择器(对应页面上的元素)绑定事件 ...

  9. [DOM Event Learning] Section 2 概念梳理 什么是事件 DOM Event

    [DOM Event Learning] Section 2 概念梳理 什么是事件 DOM Event   事件 事件(Event)是用来通知代码,一些有趣的事情发生了. 每一个Event都会被一个E ...

  10. [DOM Event Learning] Section 1 DOM Event 处理器绑定的几种方法

    [DOM Event Learning] Section 1 DOM Event处理器绑定的几种方法   网页中经常需要处理各种事件,通常的做法是绑定listener对事件进行监听,当事件发生后进行一 ...

随机推荐

  1. AJax的异步请求

    AJax的处理过程 1、传统的Web请求过程: 一般的 Web 应用程序中,用户填写表单字段并单击 Submit 按钮.然后整个表单发送到服务器,服务器将它转发给处理表单的脚本(通常是 PHP 或 J ...

  2. JPA 系列教程1-环境搭建

    JPA JPA全称Java Persistence API. JPA通过JDK 5.0注解或XML描述对象-关系表的映射关系,并将运行期的实体对象持久化到数据库中. Hibernate3.2+.Top ...

  3. cocos2d-x-2.2.6创建工程

    1.下载并安装Python,我的版本是2.7.3,不要太高,据说不能用.2.配置环境变量,将Python的安装的根目录加入系统环境变量的Path路径中(不赘述,自行配置)3.配置好之后打开cmd命令行 ...

  4. ubuntu apache2 流量限制模块

    mod-bw is an Apache 2 module provided to solve the problem of limiting users’ and virtual hosts’ ban ...

  5. 转:Linux基本命令大全

    Linux基本命令大全   新手刚刚接触Linux的时候可能处处感到不便,不过没有关系,接触新的事物都有这样的一个过程,在你用过Linux一段时间后,你就会逐渐了解Linux其实和Windows一样容 ...

  6. [转]Linux下CodeBlocks的交叉编译

    原文链接:http://blog.sina.com.cn/s/blog_602f87700100kujh.html Sam一直是Makefile流,这些天需要移植一些游戏引擎模块.这些模块在其它嵌入式 ...

  7. zencart 新页面调用好功能代码集:

    其实很多就是看变量,就可以直接调用,而变量的定义地方很多,比如language 1.  includes\languages\语言.php 2. 写个文件,放进includes\extra_confi ...

  8. L2,breakfast or lunch

    express: what a day多么糟糕的天气 I‘m coming to see you我将要来看你 what a lot of trouble he is causing他犯了多少错误啊 w ...

  9. hdu_5555_Immortality of Frog(状压DP)

    题目连接:hdu_5555_Immortality of Frog 题意: 给你一个NxN的网格,第N行的每一列都有个青蛙,这些青蛙只会往上走,上帝会在每个膜中放一个长生不老的药,一共有N个膜,每个膜 ...

  10. VS2010 C#调用C++ DLL文件

    http://www.soaspx.com/dotnet/csharp/csharp_20110406_7469.html http://www.cnblogs.com/warensoft/archi ...