主站
DreamJudge
院校信息
专业题库
模拟考试
机试真题
专业课程
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
buluoxu
2024年3月15日 22:05
日志排序 题解:vector+sort 借鉴了同体解内的输入方式
P1227
回复 0
|
赞 1
|
浏览 220
#include <iostream> #include <string> #include <vector> #include <algorithm> using namespace std; struct loggle{ string task; string shijian; float haoshi; }; bool comp(loggle lhs, loggle rhs) { if(lhs.haoshi < rhs.haoshi) return true; else if(lh...
easymoney
2024年3月14日 15:31
日志排序 题解:
P1227
回复 0
|
赞 0
|
浏览 283
//借鉴nicooy #include <stdio.h> #include <algorithm> #include <iostream> #include <string> using namespace std; struct record { string name; string start; double time; }; bool asc(record a,record b){ ...
nicooy
2024年2月26日 10:07
日志排序 题解:使用sort,将运行时间换为double
P1227
回复 0
|
赞 3
|
浏览 639
将字符串输入,分割成两部分,为了方便输出,将name存储整个日志,将其中日期和时间分割出来。日期可以直接比大小 #include <iostream> #include <string> #include<algorithm> using namespace std; typedef struct T{ string name; string data; double run; }; bool cmp(T x,T y){ ...
18937485169
2023年3月27日 00:19
大模拟——三部走(1.数据输入、2.数据处理、3.数据输出)
P1227
回复 0
|
赞 1
|
浏览 2.7k
#include <bits/stdc++.h> using namespace std; struct run_log{ string name,cost_time_str; int y,m,d,h,min,s,ms; double cost_time; string block1,block2,block3; }; bool cmp(run_log l1,run_log l2){ if(l1.cost_time<l2.cost_time) return tr...
老猫
2021年1月12日 22:27
还是sort
P1227
回复 1
|
赞 4
|
浏览 12.3k
定义一个类 将日志行拆分为 名称 时间 运行时间,然后进行排序 #include <bits/stdc++.h> using namespace std; struct T { string name; string time; string run; }t[10000]; bool compare(T t1,T t2) { if(t1.run ==t2.run ) return t1.time<t2.time; else return t1.run<t2.run; } int main() {...
wenjuice
2022年3月6日 23:21
毫秒和运行时间不能用字符串比较,要转double比较
P1227
回复 0
|
赞 3
|
浏览 4.8k
比如 '40' > '350' ,但实际40<350,因此要转double比较
ccxx123
2021年2月10日 19:02
字符串拆分,排序
P1227
回复 0
|
赞 0
|
浏览 10.0k
#include<iostream> #include<algorithm> #include<string> #include<cstring> using namespace std; typedef struct record { string task; string date; string cost_time; double second; &nb...
题目
日志排序
题解数量
7
发布题解
热门题解
1
还是sort
2
日志排序 题解:使用sort,将运行时间换为double
3
毫秒和运行时间不能用字符串比较,要转double比较
4
日志排序 题解:vector+sort 借鉴了同体解内的输入方式
5
大模拟——三部走(1.数据输入、2.数据处理、3.数据输出)
6
日志排序 题解:
7
字符串拆分,排序