AOJ 0160 - Delivery Fee

そのまま実装すればいい.

#include <iostream>
int whatPrice(int, int);

int main(){
	int n;
	while(std::cin >> n, n){
		int price = 0;
		while(n--){
			int x, y, h, w;
			std::cin >> x >> y >> h >> w;
			price += whatPrice(x+y+h, w);
		}
		std::cout << price << std::endl;
	}
}

int whatPrice(int size, int weight){
	int price = 0;
	//A size
	if(size <= 60 && weight <= 2){
		price = 600;
	}
	//B size
	else if(size <= 80 && weight <= 5){
		price = 800;
	}
	//C size
	else if(size <= 100 && weight <= 10){
		price = 1000;
	}
	//D size
	else if(size <= 120 && weight <= 15){
		price = 1200;
	}
	//E size
	else if(size <= 140 && weight <= 20){
		price = 1400;
	}
	//F size
	else if(size <= 160 && weight <= 25){
		price = 1600;
	}
	//Fサイズを超えれば,ifに引っかからず初期値の0となる.

	return price;
}