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