P1867 【Mc生存】经验值 求调
  • 板块学术版
  • 楼主ZEW2011
  • 当前回复5
  • 已保存回复5
  • 发布时间2025/1/25 16:47
  • 上次更新2025/1/25 20:34:22
查看原帖
P1867 【Mc生存】经验值 求调
1631290
ZEW2011楼主2025/1/25 16:47

https://www.luogu.com.cn/problem/P1867

#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,a[25],b[25],lv=0,ex=0,hp=10;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i]>>b[i];
		//cout<<"Hello!"<<" "<<i<<endl;
	}
	for(int i=1;i<=n;i++){
		hp-=a[i];
		if(hp>10){
			hp=10;
		}
		if(hp<=0){
			break;
		}
		ex+=b[i];
	}
	for(int i=1;;i*=2){
		if(ex>=i){
			ex-=i;
			lv++;
		}
		else{
			break;
		}
	}
	cout<<lv<<" "<<ex<<endl;
	return 0;
}
2025/1/25 16:47
加载中...