做题
`#define _CRT_SECURE_NO_WARNINGS
include
include
include
using namespace std;
int main()
{
string num;
int num2 = 0;
double sum = 0;
cin >> num;
for (char i : num)//计算其中2的个数
{
if (i - '0' == 2)
{
num2++;
}
}
if (num[0] == '-')//判断负号
{
sum = static_cast
sum = sum * 1.5;
}
else
{
sum = static_cast
}
if (num[num.size() - 1] % 2 == 0)//判断偶数
{
sum = sum * ;
}
cout << fixed << setprecision(2) << sum * 100 << "%" << endl;
return 0;
} #define _CRT_SECURE_NO_WARNINGS
include
include
using namespace std;
int main()
{
string clock;
int index = 0;
int hour = 0;
int min = 0;
cin >> clock;
index = clock.find('😂;
string temp;
for (int i = 0; i < index; i++)//提取小时
{
temp = temp + clock[i];
if (i == index - 1)
{
hour = stoi(temp);
}
}
temp.clear();
for (int i = index + 1; i < clock.size(); i++)//提取分钟
{
temp = temp + clock[i];
if (i == clock.size() - 1)
{
min = stoi(temp);
}
}
if (hour <= 12)//检验是否大于12点
{
cout << "Only " << clock << ". Too early to Dang." << endl;
return 0;
}
else if (hour > 12)//大于12的处理
{
int hour_ = hour - 12;
if (min > 0)
{
hour_++;
}
for (int i = 0; i < hour_; i++)
{
cout << "Dang";
}
cout << endl;
}
return 0;
} #define _CRT_SECURE_NO_WARNINGS
include
include
using namespace std;
struct score
{
int say;
int hand;
};
int main()
{
//计分板
vector
vector
//回合数
int num = 0;
//甲乙最大血量
int p1_max = 0;
int p2_max = 0;
//甲乙现有血量
int HP1 = 0;
int HP2 = 0;
cin >> p1_max;
cin >> p2_max;
HP1 = p1_max;
HP2 = p2_max;
cin >> num;
//比赛开始
for (int i = 0; i < num; i++)
{
score temp;
cin >> temp.say >> temp.hand;
p1.push_back(temp);
cin >> temp.say >> temp.hand;
p2.push_back(temp);
if (p1[i].say + p2[i].say == p1[i].hand && p1[i].say + p2[i].say == p2[i].hand)//都输
{
continue;
}
else if (p1[i].say + p2[i].say == p1[i].hand)//甲输
{
HP1--;
}
else if (p1[i].say + p2[i].say == p2[i].hand)//乙输
{
HP2--;
}
//胜利判断
if (HP1 < 0)
{
cout << "A" << endl;
cout << p2_max - HP2 << endl;
break;
}
else if (HP2 < 0)
{
cout << "B" << endl;
cout << p1_max - HP1 << endl;
break;
}
}
return 0;
}`

浙公网安备 33010602011771号