g*****g 发帖数: 212 | 1 struct Node23 {
int i;
int j;
int w;
bool operator> (const Node23& n) const{
return w > n.w;
}
Node23(int i, int j) : i(i), j(j), w(pow(2,i)*pow(3,j)) {}
};
int getTopN23s(int m, int n)
{
priority_queue, greater > q;
q.push(Node23(0,0));
int sum = 0;
for(int i=0; i
{
Node23 node = q.top();
q.pop();
sum = (sum + node.w) %n;
cout<阅读全帖 |
|