40分求救
查看原帖
40分求救
1099803
Yuantianyou楼主2025/7/24 17:56

40分求调!!
感谢大佬!!!
%%%!!!

#include<iostream>
using namespace std;
int n;
int deng,jing;
double xie = 10;
int main(){
	cin >> n;
	int t = 0;
	for(int i = 1;i <= n;i++){
		double x;
		int j;
		cin >> x >> j;
		//cout << x << ' ' << j << endl;
		if(xie - x <= 0){
			cout << deng <<' '<< jing;
			return 0;
		}else{
			xie -= x;
			if(x > 10) x = 10;
		}
		j += jing;
		while(j - (1 << t) >= 0){
			deng++;
			j -= (1 << t);
			t++;
		}
		jing += j; 
	}
	cout << deng <<' ' << jing;
	return 0;
}
2025/7/24 17:56
加载中...