This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
#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