Your Ride Is Here

#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
string group, comet;
int x, y;
while (cin >> comet >> group)
{
x = y = 1;
for (int i = 0; i < comet.size(); i++)
{
x *= (comet[i] - 'A' + 1);
}
for (int i = 0; i < group.size(); i++)
{
y *= (group[i] - 'A' + 1);
}
if(x % 47 == y % 47)
{
cout << "GO" << endl;
}
else
{
cout << "STAY" << endl;
}
}
return 0;
}

Greedy Gift Givers

#include <iostream>
#include <string>
#include <vector>
#include <map>
using namespace std;
#pragma warning(disable : 4996)
int main()
{
freopen("in.txt", "r", stdin);
map<string, int>Map;
vector<string>name;
string str, temp;
int n, m, money, x, i;
bool flag = false;
while (cin >> n)
{
Map.clear();
name.clear();
for (i = 0; i < n; i++)
{
cin >> str;
name.push_back(str);
Map[str] = 0;
}
for (i = 0; i < n; i++)
{
cin >> temp >> money >> m;
if(m == 0)
{
continue;
}
Map[temp] -= money;
x = money / m;
money = money - x * m;
Map[temp] += money;
while (m--)
{
cin >> str;
Map[str] += x;
}
}
if(flag)
{
cout << endl;
}
flag = true;
for (i = 0; i < name.size(); i++)
{
cout << name[i] << " " << Map[name[i]] << endl;
}
}
return 0;
}

最新文章

  1. jquery自定义滚动条 鼠标移入或滚轮时显示 鼠标离开或悬停超时时隐藏
  2. rabbitmq消息队列——&quot;Hello World!&quot;
  3. 【处理手记】U盘读不出+卷标丢失+像读卡器+大小0+无媒体
  4. ECSHOP用户协议字体颜色更改
  5. sql server 复制需要有实际的服务器名称才能连接到服务器(转载)
  6. javascript 数组对象与嵌套循环写法
  7. IP HELPER GetAdaptersAddresses 函数
  8. jQuery 之 .stop() 方法
  9. 自定义cell时,在宽的手机上显示太窄解决办法
  10. android cts 命令的说明
  11. 从SHAttered事件谈安全
  12. C++中的endl
  13. 程序员的自我救赎---10.1:APP版本控制系统
  14. springMVC源码解析--ViewResolver视图解析器执行(三)
  15. Java对象锁和类锁全面解析(多线程synchronized关键字)
  16. Python 经典面试题汇总之框架篇
  17. centos7之关于时间和日期以及时间同步的应用
  18. Linux给MySQL创建用户,并分配权限
  19. 详解Python的作用域和命名空间
  20. python_装饰器

热门文章

  1. python+selenium+Chrome options参数
  2. js的class基础
  3. linux入门系列2--CentOs图形界面操作及目录结构
  4. 利用shell脚本实现每隔60秒磁盘内存数据监控脚本
  5. JAVA8学习——Stream底层的实现三(学习过程)
  6. 使用Eureka中遇到的一些问题
  7. ASP.Net Core 3.0 中使用JWT认证
  8. 更好用的 Python 任务自动化工具:nox 官方教程
  9. 19南京网络赛B 欧拉降幂
  10. CocoaPods中的头文件import导入时不能自动补齐的解决方法