You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
584 B

2 years ago
#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
}