λ¬Έμ
μ½λ
#include <iostream>
#include <queue>
#include <algorithm>
using namespace std;
const long long int mod = 1000000007;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int T;;
cin >> T;
while(T--){
int n;
cin >> n;
priority_queue<long long int,vector<long long int >,greater<long long int >> pq;
for (int i = 0; i < n; i++) {
long long int num; cin >> num;
pq.push(num);
}
long long int score = 1;
while (pq.size() >=2) {
long long int one = pq.top(); pq.pop();
long long int two = pq.top(); pq.pop();
score *= (((one % mod) * (two % mod)) % mod);
pq.push(one * two);
score%=mod;
}
cout << score << "\n";
}
}
'Algorithm π§π»βπ» > λ°±μ€(BOJ)' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
[λ°±μ€,c++] 14724λ² - κ΄λ¦¬μλ λꡬ? (0) | 2021.11.11 |
---|---|
[λ°±μ€,c++] 14720λ² - μ°μ μΆμ (0) | 2021.11.11 |
[λ°±μ€,c++] 14716λ² - νμλ§ (0) | 2021.11.11 |
[λ°±μ€,c++] 14681λ² - μ¬λΆλ©΄ κ³ λ₯΄κΈ° (0) | 2021.11.11 |
[λ°±μ€,c++] 1463λ² - 1λ‘ λ§λ€κΈ° (0) | 2021.11.11 |
[λ°±μ€,c++] 14621λ² - λλ§ μλλ μ°μ (0) | 2021.11.11 |
λκΈ