1006

At the beginning of every day, the first person who signs in the computer room will unlock the door, and the last one who signs out will lock the door. Given the records of signing in’s and out’s, you are supposed to find the ones who have unlocked and locked the door on that day.

Input Specification:

Each input file contains one test case. Each case contains the records for one day. The case starts with a positive integer M, which is the total number of records, followed by M lines, each in the format:

ID_number Sign_in_time Sign_out_time

where times are given in the format HH:MM:SS, and ID number is a string with no more than 15 characters.

Output Specification:

For each test case, output in one line the ID numbers of the persons who have unlocked and locked the door on that day. The two ID numbers must be separated by one space.

Note: It is guaranteed that the records are consistent. That is, the sign in time must be earlier than the sign out time for each person, and there are no two persons sign in or out at the same moment.
Sample Input:

3
CS301111 15:30:28 17:00:10
SC3021234 08:00:00 11:25:25
CS301133 21:45:00 21:58:40

Sample Output:

SC3021234 CS301133

#include <stdio.h>
#include <string.h>

int main()
{
    int M;
    scanf("%d", &M);
    int i;
    char ID[16];
    char tin[10];
    char tout[10];
    char fir[16];
    char last[16];
    char max[10] = "00:00:00";
    char min[10] = "23:59:59";
    for(i=0;i<M;i++)
    {
        scanf("%s %s %s", ID, tin, tout);
        if(strcmp(tin,min) <= 0)
        {
            strcpy(min, tin);
            strcpy(fir,ID);
        }
        if(strcmp(tout,max) >= 0)
        {
            strcpy(max,tout);
            strcpy(last,ID);
        }
    }
    printf("%s %s", fir, last);
    return 0;
}
### 回答1: Websocket 1006错误是指Websocket连接异常终止的错误。它通常是由于以下原因之一导致的: 1. 网络连接中断导致Websocket连接丢失。 2. Websocket服务器出现故障或崩溃。 3. Websocket客户端或服务器端代码错误。 要解决此问题,可以尝试以下几种方法: 1. 检查网络连接是否正常,确保没有网络连接中断。 2. 检查Websocket服务器是否正常运行并且没有故障或崩溃。 3. 检查Websocket客户端或服务器端代码是否正确,并修复任何错误。 如果以上方法都无法解决问题,可以尝试使用其他Websocket库或工具进行连接,或者联系Websocket服务提供商以获得更多帮助。 ### 回答2: WebSocket协议中的状态码1006表示连接异常关闭。当WebSocket连接由于某种原因无法正常关闭时,就会出现这个状态码。 常见的导致WebSocket连接异常关闭的原因有以下几种: 1. 网络中断:当网络连接异常中断,例如断网或者网络不稳定时,WebSocket连接就会关闭,并且状态码为1006。 2. 服务器异常:如果WebSocket服务器发生故障或者出现异常,会导致连接异常关闭。 3. 客户端异常:当客户端应用或者浏览器出现异常,例如崩溃或者非正常关闭,也会导致WebSocket连接异常关闭。 4. TLS连接异常:当使用WebSocket over TLS(即wss://)进行连接时,如果TLS握手失败,就会导致连接异常关闭。 当出现WebSocket连接异常关闭时,通常可以通过以下步骤进行排查和解决: 1. 检查网络连接:确认客户端和服务器的网络连接正常,确保网络稳定。 2. 检查服务器状态:检查WebSocket服务器的运行状态,确认服务器没有发生异常。 3. 检查客户端应用:如果是客户端应用出现异常,尝试重新启动应用或者确保应用正常运行。 4. 检查TLS连接:如果使用wss://进行连接,确认TLS证书是否有效,并且抓取TLS连接握手过程的日志进行排查。 通过以上排查步骤,可以帮助定位WebSocket连接异常关闭的原因,并且采取相应的措施进行解决。 ### 回答3: websocket 1006错误表示连接关闭,原因是连接尝试失败或被服务器关闭。这个错误码在WebSocket协议中定义,并用于指示不可恢复的错误。以下是可能导致websocket 1006错误的情况: 1. 网络中断:当客户端或服务器之间的网络连接中断时,就会发生这个错误。这可能是由于网络问题、服务器故障、恶劣的网络连接或其他因素引起的。 2. 消息过大:如果WebSocket消息超出服务器或客户端的限制大小,连接可能会关闭,并返回1006错误。某些服务器和客户端可能限制WebSocket消息的大小。 3. 服务器关闭连接:服务器可能会在连接过程中关闭WebSocket连接,原因可能是服务器出错或意外终止。 4. SSL证书错误:如果使用了SSL加密连接,但证书出现问题,例如证书过期或不匹配,也可能导致WebSocket连接关闭并返回该错误。 解决WebSocket 1006错误的方法包括以下几个方面: 1. 检查网络连接:确保客户端和服务器之间的网络连接是稳定的,没有中断或延迟。可以尝试使用其他设备或网络进行连接来排除可能的网络问题。 2. 检查服务器配置:确保服务器设置正确,并且没有对连接进行限制,例如限制消息大小。查看服务器日志以获取更多详细信息。 3. 检查SSL证书:如果使用了SSL加密连接,请确保证书没有问题,例如过期或不匹配。可以尝试更新证书或使用有效的证书。 4. 使用适当的库和工具:使用适当的WebSocket库和工具可以减少出现错误的可能性。这些库和工具通常会处理WebSocket连接的实现细节,并提供更好的错误处理机制。 无论出现什么错误,重要的是要理解错误的原因,并通过适当的方式来解决和预防该错误的发生。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值