自己写了一个代码只过了测试点0和3.。。。

然后百度发现没有匹配记录的用户不应该输出,于是过了一两天又重新写了一个,代码如下:
#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
const int maxn=1100;
int per_bill[24];
struct customer{
char id[30];//id
char time_stre[30];//时间
bool state;
int MM,dd,hh,mm;
int rank;
}stu[maxn];
bool mouth[maxn]={
0};//记录用户每月账单是否输出过
int count_phone[maxn]={
0};//记录有几对配对的电话记录 根据rank查找
int total_cost[maxn]={
0};//记录用户总的费用
bool cmp(customer a,customer b)
{
if(strcmp(a.id,b.id)!=0)return strcmp(a.id,b.id)<0;
else if(a.MM!=b.MM)return a.MM

博主在解决PAT A1016题目的过程中遇到超时问题,尝试了两次编写代码,但仅通过了部分测试用例。第一版代码通过了测试点0和3,第二版代码仍存在超时问题。博主推测未匹配记录的用户处理可能是问题所在,并计划在学习STL之后继续解决这个问题。
最低0.47元/天 解锁文章
1075

被折叠的 条评论
为什么被折叠?



