文章

20

粉丝

0

获赞

51

访问

1.4k

头像
数字排序 题解:
P1966 华东师范大学2023年机试
发布于2026年3月7日 18:56
阅读数 62

1.pair<xx,xx>记录double值和小数位数

2.字符串查找不到:==string::npos

 

 

#include<bits/stdc++.h>
using namespace std;
int main()
{
    vector<string>s;
    int n;
    cin >> n;
    int comma_pos = 0;
    for (int i = 0; i < n; i++)
    {
        string c;
        cin >> c;
        s.push_back(c);
    }
    priority_queue < pair<double, int>, vector < pair<double, int>>, greater<pair<double, int>>> q;
    for (vector<string>::iterator it = s.begin(); it != s.end(); it++)
    {
        if ((*it).find(".") != string::npos)
            q.push({ stod(*it),(*it).length() -...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发