提交 99692a68 编写于 作者: CairBin's avatar CairBin

2022-09-06

上级 6bd3d525
double res = average(num);
cout << res << endl;
\ No newline at end of file
{
"files.associations": {
"list": "cpp",
"iostream": "cpp"
}
}
\ No newline at end of file
#include <iostream>
#include <map>
using namespace std;
int main()
{
int n;
while(cin >> n)
{
string str;
for (int i = 0; i < n; i++)
cin >> str;
map<string, int> shop;
int m;
cin >> m;
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
int price;
cin >> price >> str;
shop[str] += price;
}
map<string, int>::iterator it;
int rank = 1;
for (it = shop.begin(); it != shop.end(); it++)
{
if(it->second > shop["memory"])
++rank;
}
cout << rank << endl;
}
}
return 0;
}
\ No newline at end of file
#include <iostream>
#include <list>
using namespace std;
int main()
{
int n, kill_man;
while(cin >> n >> kill_man)
{
list<bool> judge;
for (int i = 1; i <= 2*n; i++)
judge.push_back(true); //false代表已死(坏人)
list<bool>::iterator it;
int cnt = 0;
int isKill = 1;
for (it = judge.begin(); cnt<n; it++)
{
if(it == judge.end())
it = judge.begin(); //回到列表起始处
if(isKill==kill_man && *it)
{
*it = false;
cnt++;
isKill = 1;
}
if (*it)
isKill++;
}
int cnt2 = 1;
for (it = judge.begin(); it != judge.end(); it++)
{
if (*it)
cout << "G";
else
cout << "B";
if (cnt2 % 50 == 0)
cout << endl;
cnt2++;
}
cout << endl
<< endl;
}
return 0;
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册