文章

6

粉丝

369

获赞

1

访问

47.1k

头像
字符串拆分,排序
P1227 北京大学机考题
发布于2021年2月10日 19:02
阅读数 10.1k

#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
using namespace std;
typedef struct record {
    string task;
    string date;
    string cost_time;
    double second;
    bool operator <(const record&t)const {
        if (second == t.second)return date < t.date;
        else return second < t.second;
    }
}record;
record a[10001];
int main() {
    string s="";
    int cnt = 0;
    while(getline(cin, s)&&s.size()) {  //将s拆分
        int i = 0;
        int flag = 0;
        while (s[i] != ' '&&i < s.size())
            a[cnt].task += ...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发