Data Manager 数据结构+STL

本文介绍了一种使用小根堆实现优先队列的方法,并通过C++代码示例展示了如何进行元素的添加、删除及获取最小元素的操作。此外,还提供了一种将数值转为负数以简化实现的技巧。

/*优先队列的小根堆的写法。水题。
还有一个方法是将所有的值都变为负数,然后直接用优先队列。
输出输入和输出还有字符串用c,不然tle。*/

#include <iostream>
#include <queue>
#include <cstring>
#include <stdio.h>
using namespace std;

int main()
{
    priority_queue<int,vector<int>,greater<int> > v;
    char s[20];
    int t,n;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%s",s);
        if(strcmp(s,"add")==0)
        {
            scanf("%d",&n);
            v.push(n);
        }
        else if(s[0]=='d')
        {
            if(v.empty()) continue;
            else v.pop();
        }
        else
        {
            if(!v.empty())
            printf("%d\n",v.top());
            else continue;
        }
    }
    return 0;
}


                
Model Manager mmgetalltags - Get all assigned tags for a branch mmgetbranch - Get branch variable in Model Manager mmgetcommit - Get commit message from an item mmmodelinfo - Model info for models stored in Model Manager or as files mmsave - Save model in Model Manager mmsearch - Full-text and keyword search in Model Manager User interface functions mphcd - Change directory to the directory of the model mphdoc - Open documentation window mphload - Load a COMSOL model MPH-file mphopen - GUI for opening recent model files mphrun - Run various actions on nodes mphsave - Save a COMSOL model as a file mphversion - Return the version number of COMSOL Multiphysics mphlaunch - Launch COMSOL Multiphysics Client and import a model mphstart - Connect MATLAB to a COMSOL server mphstartcomsolmphserver - Start Comsol Multiphysics server Geometry functions mphgeom - Plot a geometry in a MATLAB figure mphgeominfo - Get geometry information mphimage2geom - Convert image to geometry mphviewselection - Display a geometric entity selection in a MATLAB figure Mesh functions mphmesh - Plot mesh in a MATLAB figure mphmeshstats - Retrieve mesh statistics and and mesh data information mphwritemesh - Write mesh data as an mphtxt, mphbin or STL file Utility functions mphbatchinfo - Get information about the batch solution structures mphevaluate - Evaluate parameter expressions in model mphgetadj - Return adjacency info for geometric entities mphgetcoords - Return point coordinates of geometry entities mphgetu - Return solution vector mphinputmatrix - Add a linear matrix system to a model mphinterpolationfile - Save data in file readable by the Interpolation feature mphmatrix - Get model matrices mphmeasure - Measure entites in a geometry mphquad2tri - Convert plotdata quad mesh into simplex mesh mphreadstl - Read an STL file and returns the data as a struct mphreduction - Return reduced order state space matrices for a model mphselectball - Select geometric entity using a ball selection mphselectbox - Select geometric entity using a rubberband/box mphselectcoords - Select geometric entity using point coordinates mphsolinfo - Get information about a solution object mphsolutioninfo - Get information about solution objects and data sets containing given parameters mphstate - Get state-space matrices for dynamic system mphwritestl - Export plot data as an STL file mphxmeshinfo - Extract information about the extended mesh Postprocessing functions mphaddplotdata - Add plot data to plotgroup mphcolortable - Return colortable data mphdataset - Plots a dataset mphdatasetinfo - Gets information about datasets mpheval - Evaluate expressions on node points mphevalglobalmatrix - Evaluate matrix variables mphevalpoint - Evaluate expressions at geometry vertices mphevalpointmatrix - Evaluate matrix quantities at points in the geometry mphglobal - Evaluate global quantities mphint2 - Perform integration of expressions mphinterp - Evaluate expressions in arbitrary points or data sets mphmax - Perform maximum of expressions mphmean - Perform mean of expressions mphmin - Perform minimum of expressions mphparticle - Evaluate expressions on particle trajectories mphplot - Render a plot group in a figure window mphray - Evaluate expressions on ray trajectories mphreport - Add report to model or run report generator mphsurf - Create plot data from surf data mphtable - Get table data Model information and navigation mphapplicationlibraries - GUI for viewing the Model Library mphgetexpressions - Get the model variables and parameters mphgetproperties - Get properties from a model node mphgetselection - Get information about a selection node mphgetview - Information about a view mphcomponentinfo - Gets information about components mphmodel - Return tags for the nodes and subnodes in the COMSOL model object mphnavigator - GUI for viewing the COMSOL model object mphsearch - GUI for searching expressions in the COMSOL model object mphsetparam - Set parameter values and descriptions mphshowerrors - Show messages in error and warning nodes in the COMSOL model object mphtags - Return tags and names for model nodes mphthumbnail - Get and set model thumbnail images COMSOL Multiphysics - LiveLink for Matlab Version 6.3 1-Oct-2024 Copyright 2010-2024 COMSOL Model Manager mmgetalltags - Get all assigned tags for a branch mmgetbranch - Get branch variable in Model Manager mmgetcommit - Get commit message from an item mmmodelinfo - Model info for models stored in Model Manager or as files mmsave - Save model in Model Manager mmsearch - Full-text and keyword search in Model Manager User interface functions mphcd - Change directory to the directory of the model mphdoc - Open documentation window mphload - Load a COMSOL model MPH-file mphopen - GUI for opening recent model files mphrun - Run various actions on nodes mphsave - Save a COMSOL model as a file mphversion - Return the version number of COMSOL Multiphysics mphlaunch - Launch COMSOL Multiphysics Client and import a model mphstart - Connect MATLAB to a COMSOL server mphstartcomsolmphserver - Start Comsol Multiphysics server Geometry functions mphgeom - Plot a geometry in a MATLAB figure mphgeominfo - Get geometry information mphimage2geom - Convert image to geometry mphviewselection - Display a geometric entity selection in a MATLAB figure Mesh functions mphmesh - Plot mesh in a MATLAB figure mphmeshstats - Retrieve mesh statistics and and mesh data information mphwritemesh - Write mesh data as an mphtxt, mphbin or STL file Utility functions mphbatchinfo - Get information about the batch solution structures mphevaluate - Evaluate parameter expressions in model mphgetadj - Return adjacency info for geometric entities mphgetcoords - Return point coordinates of geometry entities mphgetu - Return solution vector mphinputmatrix - Add a linear matrix system to a model mphinterpolationfile - Save data in file readable by the Interpolation feature mphmatrix - Get model matrices mphmeasure - Measure entites in a geometry mphquad2tri - Convert plotdata quad mesh into simplex mesh mphreadstl - Read an STL file and returns the data as a struct mphreduction - Return reduced order state space matrices for a model mphselectball - Select geometric entity using a ball selection mphselectbox - Select geometric entity using a rubberband/box mphselectcoords - Select geometric entity using point coordinates mphsolinfo - Get information about a solution object mphsolutioninfo - Get information about solution objects and data sets containing given parameters mphstate - Get state-space matrices for dynamic system mphwritestl - Export plot data as an STL file mphxmeshinfo - Extract information about the extended mesh Postprocessing functions mphaddplotdata - Add plot data to plotgroup mphcolortable - Return colortable data mphdataset - Plots a dataset mphdatasetinfo - Gets information about datasets mpheval - Evaluate expressions on node points mphevalglobalmatrix - Evaluate matrix variables mphevalpoint - Evaluate expressions at geometry vertices mphevalpointmatrix - Evaluate matrix quantities at points in the geometry mphglobal - Evaluate global quantities mphint2 - Perform integration of expressions mphinterp - Evaluate expressions in arbitrary points or data sets mphmax - Perform maximum of expressions mphmean - Perform mean of expressions mphmin - Perform minimum of expressions mphparticle - Evaluate expressions on particle trajectories mphplot - Render a plot group in a figure window mphray - Evaluate expressions on ray trajectories mphreport - Add report to model or run report generator mphsurf - Create plot data from surf data mphtable - Get table data Model information and navigation mphapplicationlibraries - GUI for viewing the Model Library mphgetexpressions - Get the model variables and parameters mphgetproperties - Get properties from a model node mphgetselection - Get information about a selection node mphgetview - Information about a view mphcomponentinfo - Gets information about components mphmodel - Return tags for the nodes and subnodes in the COMSOL model object mphnavigator - GUI for viewing the COMSOL model object mphsearch - GUI for searching expressions in the COMSOL model object mphsetparam - Set parameter values and descriptions mphshowerrors - Show messages in error and warning nodes in the COMSOL model object mphtags - Return tags and names for model nodes mphthumbnail - Get and set model thumbnail images。以上是COMSOL with matlab接口中的部分代码含义,我需要你学习并记住这段代码
11-18
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值