回分類題庫
d294: 105OOP Lab Exercise: Pokemon Trainer Record
出處:

Difficulity : N/A
Accepted : 37 Times | Submit :73 Times | Clicks : 392
Accepted : 36 Users | Submit : 37 Users | Accepted rate : 97%
Time Limit :10000 ms | Memory Limit : 64000 KBytes
題目加入時間 : 2016-12-24 15:40

Content :

下列資料是 Pokemon 訓練師在道館 A 及道館 B 的戰績,請用 Map 實做一檢索程式並顯示之


你可以利用 Struct 或 Class 儲存資料


例如:

struct data

{

   int trainerLevel;

   int trainerGymAWins;

   int trainerGymALosses;


   int trainerGymBWins;

   int trainerGymBLosses;


   string s_1ndMostFrequentPokemon;

   string s_2ndMostFrequentPokenmon;

   string s_3ndMostFrequentPokenmon;


   float s_1ndWinRate;

   float s_2ndWinRate;

   float s_3ndWinRate;

};


Input :

首先輸入一整數,代表總共有幾位訓練師的資料要輸入

接著輸入以下資料


訓練師的姓名

訓練師的等級

在道館 A 的勝利次數、落敗次數

在道館 B 的勝利次數、落敗次數


[最常用的 Pokemon1] [勝率]

[最常用的 Pokemon2] [勝率]

[最常用的 Pokemon3] [勝率]


若 Pokemon 的種類欄輸入 None,則不需輸入勝率

勝率是 float 形態,最後顯示應該進位到小數點後兩位


輸入完訓練師戰績資料後有兩個指令可以執行

  1. S 訓練師姓名:顯示戰績

  2. Q:離開程式

Output :

輸入 [S 訓練師姓名] 指令後,應按下列格式顯示資料:

Trainer:

Level:

===============Gym A Record===============

Wins:

Losses:

===============Gym B Record===============

Wins:

Losses:

=====The Most Frequently Used Pokemon=====

1. [Pokemon] [win rate]

2. [Pokemon] [win rate] (if Pokemon is "None", you don't need to print)

3. [Pokemon] [win rate] (if Pokemon is "None", you don't need to print)


若沒有常用的 Pokemon,只要印出 None 即可

若輸入的訓練師姓名不存在,應該印出 Trainer does not exist.

Sample Input :

3
TsaiYenLi
9999
100 0
99 1
Pikachu 100.0000
Bulbasaur 100.0000
Squirtle 99.9899
ChenHsiangHuang
0
0 0
0 0
None
None
None
ChunHsiangWang
87
76 29
19 19
Charmander 87.8787
None
None
S oOne
S TsaiYenLi
S ChenHsiangHuang
S ChunHsiangWang
Q

Sample Output :

Trainer does not exist.
Trainer:TsaiYenLi
Level:9999
===============Gym A Record===============
Wins:100
Losses:0
===============Gym B Record===============
Wins:99
Losses:1
=====The Most Frequently Used Pokemon=====
1.Pikachu:100.00%
2.Bulbasaur:100.00%
3.Squirtle:99.99%
Trainer:ChenHsiangHuang
Level:0
===============Gym A Record===============
Wins:0
Losses:0
===============Gym B Record===============
Wins:0
Losses:0
=====The Most Frequently Used Pokemon=====
None
Trainer:ChunHsiangWang
Level:87
===============Gym A Record===============
Wins:76
Losses:29
===============Gym B Record===============
Wins:19
Losses:19
=====The Most Frequently Used Pokemon=====
1.Charmander:87.88%

Hint :

提示:
小數點後兩位
#include
cout  << fixed  <<  setprecision(2) << 3.1234  <<  endl;
The ouput is 3.12.

Author :

(管理員:oopTA)

  Solve it!   Status Forum (0)

C++
C
JAVA
77439. oop104703052 (4 ms , 530KB)
77437. oop104703033 (4 ms , 526KB)
77431. oop104703027 (4 ms , 546KB)
77425. oop104703047 (4 ms , 528KB)
77253. oop104703042 (4 ms , 538KB)
沒有解題記錄 沒有解題記錄

執行時間會受很多因素影響因此僅供參考,主機等級請看這裡