解題心得
最後好像也沒用到s跟a的值。
程式碼
#include <iostream> #include <algorithm> using namespace std; int main() { int t, s, a, f; cin >> t; while (t--) { int arrS[50001], arrA[50001]; cin >> s >> a >> f; for (int i = 0; i < f; i++) cin >> arrS[i] >> arrA[i]; sort(arrS, arrS + f); sort(arrA, arrA + f); if (f % 2 == 1) cout << "(Street: " << arrS[f / 2] << ", Avenue: " << arrA[f / 2] << ")" << endl; else cout << "(Street: " << arrS[f / 2 - 1] << ", Avenue: " << arrA[f / 2 - 1] << ")" << endl; } return 0; }
沒有留言:
張貼留言