最终80分,怎么改都不对,里面有第五个测试点的输入输出,麻烦大佬帮忙看看 在线等
查看原帖
最终80分,怎么改都不对,里面有第五个测试点的输入输出,麻烦大佬帮忙看看 在线等
1404557
maodan11hao楼主2024/8/5 10:12
#include<bits/stdc++.h>
using namespace std;
int n;
double x,a;//就是题目里的x和a 
int ans=0;
int pf(int s){//这个函数用来算接下来要多少经验才能升一级 
	long long cnt=1;
	for(int j=1;j<s;j++){
		cnt*=2;
	}
	return cnt;
}
int p=10;//血量 
int d=0;//经验等级 
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>x>>a;
		p-=x;
		if(p<=0)continue;
		if(p>10)p=10;
		ans+=a;
	}
	int c=0;
	while(1){
		int q=pf(c); 
		if(ans-q>=0){
			ans-=q;
			d++;
		}
		else{
			break;
		}
		c++;
	}
	cout<<d<<" "<<ans<<endl;
	/*
	10
	4.5 100
	5.4 100
	-100 100
	-10000 0
	9.9 10
	-0.1 2
	0.2 2
	1 0
	1 0
	1 13289
	这是第5个测试点的输入
	
	8 57
	这个是第五个测试点的正常输出 
	*/
	return 0;
}
2024/8/5 10:12
加载中...