25 lines
608 B
C++
25 lines
608 B
C++
|
|
#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
|
|||
|
|
}
|