d984.
棄保效應
--
板橋高中教學題
| From: [114.43.215.74] |
發表日期
:
2015-02-16 15:02
#include <map>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
map <long long int, string> candidateDictionary;
long long int aTicket, bTicket, cTicket;
long long int ticketArray[3];
while (cin >> aTicket >> bTicket >> cTicket) {
ticketArray[0] = aTicket;
ticketArray[1] = bTicket;
ticketArray[2] = cTicket;
candidateDictionary[aTicket] = "A";
candidateDictionary[bTicket] = "B";
candidateDictionary[cTicket] = "C";
sort(ticketArray, ticketArray + 3);
if (ticketArray[2] > ticketArray[0] + ticketArray[1]) {
cout << candidateDictionary[ticketArray[2]] << endl;
}
else if (ticketArray[0] < ticketArray[1]) {
cout << candidateDictionary[ticketArray[1]] << endl;
}
else {
cout << candidateDictionary[ticketArray[0]] << endl;
}
}
return 0;
}
參考看看 :D