---
# System prepended metadata

title: Apex rank遊戲部分運作程式

---

Apex rank遊戲部分運作程式
===
Posted on 2022/4/29 | By : Victoria1103



```cpp=
#include <iostream>
#include <string>
#include <limits>
using namespace std;

int main (){
	int bronze , silver , gold , platium , diamond , master ; //排位階級 
	int entrance_fee , score , kill , assist , kill_rp , position , position_score ;
	string rank ;
	cin >> rank >> position >> kill >> assist ;//輸入排位 名次
	if (rank == "bronze"){
		entrance_fee = 0 ;//入場費
	} 
	else if (rank == "silver"){
		entrance_fee = -12 ;
	}
	else if (rank == "gold"){
		entrance_fee = -24 ; 
	}
	else if (rank == "platium"){
		entrance_fee = -36 ;
	}
	else if (rank == "diamond"){
		entrance_fee = -48 ;
	}
	else if (rank == "master"){
		entrance_fee = -60 ;
	} 
	
	if (position>=14){
		position_score = 0 ;//名次分 
	}
	else if (position>=11 && position<=13){
	    position_score = 5 ;
	}
	else if (position>=9 && position<=10){
		position_score = 10 ;
	} 
	else if (position>=7 && position<=8){
		position_score = 20 ;
	}
	else if (position==6){
		position_score = 30 ;
	}
	else if (position==5){
		position_score = 45 ;
	}
	else if (position==4){
		position_score = 55 ;
	}
	else if (position==3){
		position_score = 70 ;
	}
	else if (position==2){
		position_score = 95 ; 
	}
	else if (position==1){
		position_score = 125 ;
	}
	
	if (position>=11){
		kill_rp = 10*(kill + assist) + 0*(kill + assist) ;//擊殺助攻+rp  
	}
	else if (position>=6 && position<=10){
		kill_rp = 10*(kill + assist) + 1*(kill + assist) ;
	}
	else if (position>=5 && position<=4){
		kill_rp = 10*(kill + assist) + 5*(kill + assist) ;
	}
	else if (position==3){
		kill_rp = 10*(kill + assist) + 8*(kill + assist) ;
	}
	else if (position==2){
		kill_rp = 10*(kill + assist) + 11*(kill + assist) ;
	}
	else if (position==1){
		kill_rp = 10*(kill + assist) + 15*(kill + assist) ;
	}
	kill_rp = (kill_rp > 125) ? 125 : kill_rp ;//最高125rp
	score = entrance_fee + position_score + kill_rp ;
	cout << "排位 : " << rank << endl ;
	cout << "名次 : " << "第" << position << "名" << endl ;
	cout << "擊殺 : " << kill << "顆頭" << endl ;
	cout << "助攻 : " << assist << "助攻" << endl ;
	cout << "得分 : " << score << " rp" << endl ; 
	
	return 0 ;
}