大模拟,debug了好久,最后发现中间有个地方理解错了。
题目链接
这里理解有误:
100分代码:
#include <bits/stdc++.h>
using namespace std;
//#define int long long
const int M = 1000010;
int N,Tdef,Tmax,Tmin;
string H; // Host name
int n;
struct IP{
int state; // ip状态 // 0:未分配 1:待分配 2:占用 3:过期
string host; // 当前占用主人 或 过期时的占用主人
int over; // 设置过期时间
}node[M];
signed main()
{
//freopen("c.out","w",stdout);
cin >> N >> Tdef >> Tmax >> Tmin >> H >> n;
for(int i=1;i<=N;i++){
node[i] = {
0,"",0};
}
while(n--){
int time; // 当前日期
string send,rec,kind;
int ip,overtime;
cin >> time >> send >> rec >> kind >> ip >> overtime;
if(rec!="*" && rec!=H && kind!="REQ") continue;