90分WA#3 , 求调!
查看原帖
90分WA#3 , 求调!
322120
H2O_MERO楼主2023/10/14 21:01
#include<iostream>
using namespace std;
const int N = 10;
struct point{
	int sum , getsum , single , rest;
}a[N];

int main()
{
	int n , nowp = 0;
	cin >> n;
	for( int i = 1 ; i <= n ; i++ ){
		cin >> a[i].sum >> a[i].getsum;
		a[i].single = 100 / a[i].sum; 
		nowp += 100 * a[i].getsum / a[i].sum;
		a[i].rest = a[i].sum - a[i].getsum;
	}
	int k;
	cin >> k;
	if( nowp >= k ){
		cout << "Already Au." << endl;
	}
	else{
		int cha = k - nowp;
		for( int i = 1 ; i <= n ; i++ ){
			int need = ( cha / a[i].single ) + 1;
			if( need > a[i].rest )
				cout << "NaN" << endl;
			else if( cha % a[i].single == 0 )
				cout << need - 1 << endl;
			else
				cout << need << endl;
		}
	}
	return 0;
}
2023/10/14 21:01
加载中...