Section 1.1
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的更多相关文章
- keil MDK error: L6236E: No section matches selector - no section 错误
今天板子刚到,新建的第一个工程就报错了. .\Objects\cse.sct(7): error: L6236E: No section matches selector - no section t ...
- 【代码笔记】iOS-一个tableView,两个section
一,效果图. 二,工程图. 三,代码. RootViewController.h #import <UIKit/UIKit.h> @interface RootViewController ...
- gcc/linux内核中likely、unlikely和__attribute__(section(""))属性
查看linux内核源码,你会发现有很多if (likely(""))...及if (unlikely(""))...语句,这些语句其实是编译器的一种优化方式,具 ...
- <section> 标签
最近正在学习html5,刚接触html5,感觉有点不适应,因为有一些标签改变了,特别是div, section article这三个标签,查了一些资料,也试着用html5和css3布局网页,稍微有点头 ...
- [ASP.NET MVC 小牛之路]12 - Section、Partial View 和 Child Action
概括的讲,View中的内容可以分为静态和动态两部分.静态内容一般是html元素,而动态内容指的是在应用程序运行的时候动态创建的内容.给View添加动态内容的方式可归纳为下面几种: Inline cod ...
- $\LaTeX$笔记:Section 编号方式(数字、字母、罗马)&计数器计数形式修改
$\LaTeX$系列根目录: Latex学习笔记-序 IEEE模板中Section的编号是罗马数字,要是改投其他刊物的话可能得用阿拉伯数字,所以可以在导言部分做如下修改(放在导言区宏包调用之后): \ ...
- [DOM Event Learning] Section 4 事件分发和DOM事件流
[DOM Event Learning] Section 4 事件分发和DOM事件流 事件分发机制: event dispatch mechanism. 事件流(event flow)描述了事件对象在 ...
- [DOM Event Learning] Section 3 jQuery事件处理基础 on(), off()和one()方法使用
[DOM Event Learning] Section 3 jQuery事件处理基础 on(),off()和one()方法使用 jQuery提供了简单的方法来向选择器(对应页面上的元素)绑定事件 ...
- [DOM Event Learning] Section 2 概念梳理 什么是事件 DOM Event
[DOM Event Learning] Section 2 概念梳理 什么是事件 DOM Event 事件 事件(Event)是用来通知代码,一些有趣的事情发生了. 每一个Event都会被一个E ...
- [DOM Event Learning] Section 1 DOM Event 处理器绑定的几种方法
[DOM Event Learning] Section 1 DOM Event处理器绑定的几种方法 网页中经常需要处理各种事件,通常的做法是绑定listener对事件进行监听,当事件发生后进行一 ...
随机推荐
- OpenGL--------纹理处理
我们可以将像素数据按照矩形进行缩小和放大,但是还不足以满足我们的要求.例如要将一幅世界地图绘制到一个球体表面,只使用glPixelZoom这样的函数来进行缩放显然是不够的.OpenGL纹理映射功能支持 ...
- Android中图片占用内存的计算
Android中图片占用内存的计算 原文链接 http://blog.sina.com.cn/s/blog_4e60b09d01016133.html 在Android开发中,我现在发现很多人还不 ...
- SQLite错误总结 error code 19: constraint failed
SQLite错误总结 1. android.database.sqlite.SQLiteConstraintException: error code 19: constraint failed错误原 ...
- useradd adduer 的区别
区别 1). 使用useradd时,如果后面不添加任何参数选项,例如:#sudo useradd test创建出来的用户将是默认“三无”用户:一无Home Directory,二无密码,三无系统She ...
- Bom2016/4/21
Browser Object Model 浏览器对象模型 open(地址,打开方式) open('http://www.baidu.com','_self')本窗口打开百度 open('http:// ...
- PAT (Advanced Level) 1100. Mars Numbers (20)
简单题. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #in ...
- USACO Section 1.4 Arithmetic Progressions 解题报告
题目 题目描述 现在给你一个数集,里面的数字都是由p^2+q^2这种形式构成的0 <= p,q <= M,我现在需要你在其中找出一个长为N的等差数列,数列中的第一个数字为a,公差为b,当你 ...
- 解决IIS网站.woff 404 (Not Found)问题
一.在没有权限操作IIS管理器的情况下,在Web.config中的system.webServer节点进行如下配置: <system.webServer> <staticConten ...
- opencart配置United States Postal Service快递
1.安装United States Postal Service 2.登录https://registration.shippingapis.com/,注册帐号,稍后会收到邮件 3.打开邮件,记下Us ...
- json optString getString
optString 和 getString 区别. optString 当接收到的为空时候 不会报错