Files
python/LuoGu/RuMen/P1867.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

25 lines
608 B
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <bits/stdc++.h>
using namespace std;
int main() {
int n;//n次操作
scanf("%d", &n);//输入
double x = 10, a, b;//不用数组
int sum = 0;//经验值
for (int i = 1; i <= n; i++) {
scanf("%lf%lf", &a, &b);
x -= a;
if (x > 10) x = 10;//不要爆掉
if (x <= 0) break;//生命值过低,退出游戏
else sum += b;//生命值累加
}
int k = 0;
while (sum >= pow(2, k))//判断级别数
{
sum -= pow(2, k);
k++;
}
printf("%d ", k);
printf("%d", sum);//输出over
}