强训第32

选择

强训第32_第1张图片

 D

强训第32_第2张图片

 B

强训第32_第3张图片

 A

强训第32_第4张图片

 A

发送TCP意思应该是已经建立了连接,会超时重传。在未建立连接的时候,会放弃该链接

强训第32_第5张图片

 C

强训第32_第6张图片

A

80端口是http

强训第32_第7张图片

 A

交换机攻击主要有五种:VLAN跳跃攻击 生成树攻击 MAC表洪水攻击 ARP攻击 VTP攻击

强训第32_第8张图片

 

强训第32_第9张图片

 B

强训第32_第10张图片

 A

2^(32-26)+2^(32-27)+2^(32-27)=128 减去网段号和广播号为126

强训第32_第11张图片

 B

强训第32_第12张图片

 

编程

斐波那契凤尾

斐波那契凤尾__牛客网

强训第32_第13张图片

#include 
#include 
#include 
using namespace std;

int main() 
{
    vectordp(100000,0);
    dp[0]=1;dp[1]=2;
    int border=-1;//大于1000000的边界n
    for(int i=2;i<100000;i++)
    {
        long long tmp=dp[i-1]+dp[i-2];
        if(tmp>=1000000 && border==-1)
        {
            border=i+1;//表示第border之后的值超过了100 0000
        }
        dp[i]=tmp%1000000;
    }
    int n;
    while(cin>>n)
    {
        long long res=dp[n-1];
        if(n

淘宝收益

淘宝网店__牛客网

// write your code here cpp

#include

using namespace std;

//非闰年为标准
int totalday[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
//非闰年 - 每个月的总收益
int totalMoney[12] = {62, 28, 31, 60, 31, 60, 31, 62, 60, 62, 30, 62};

//判断该月份是否为素数
bool Judge_IsPriNum(int month){
    if(month == 2 || month == 3 || month == 5 || month == 7 ||
          month == 11){
        return true;
    }
    return false;
}

//判断该年份是否为闰年
bool Judge_IsLeaYear(int year){
    if( (year % 4 == 0 && year % 100 != 0) || 
              year % 400 == 0){
        return true;
    }
    return false;
}

//计算相差day2 - day1天数的收益
int Caclue_Day(int day1, int day2, int month){
    //1 - 31, 是31天    31 - 1 = 30 -- 得加1
    int sum = day2 - day1 + 1;
    if(!Judge_IsPriNum(month)){
        //非素数一天赚2块
        sum += sum;
    }
    return sum;
}

//计算相差month2 - month1 整月数的收益
int Caclue_Month(int month1, int month2, int year){
    int sum = 0;
    for(int i = month1; i <= month2; ++i){
        //下标-1
        sum += totalMoney[i - 1];   
        //2月 - 闰年 - 多加1块
        if(i == 2 && Judge_IsLeaYear(year)){
            sum += 1;
        }
    }
    return sum;
}

//计算相差year2 - year1 整年数的收益
int Caclue_Year(int year1, int year2){
    int sum = 0;
    for(int i = year1; i <= year2; ++i){
        sum += Caclue_Month(1, 12, i);   
    }
    return sum;
}

int main(){
    
    
    //定义接受的年月日
    int year1, month1, day1;
    int year2, month2, day2;

    while(cin >> year1 >> month1 >> day1 
         >> year2 >> month2 >> day2){
        //由于是整数 还是 是空格分隔, 采用cin就可以
        int total_num = 0;
        
        if(year1 == year2){
            //同一年份
            if(month1 == month2){
                //同一月份     
                total_num =  Caclue_Day(day1, day2, month1);
            }
            else{
                //不同月份
                //1、先计算两者相差整月份的收益
                total_num += Caclue_Month(month1, month2, year1);
                //2、month1首月不足一月的天数收益
                total_num += Caclue_Day(day1, totalday[month1 - 1], month1);
                //3、month2尾月不足一月的天数收益
                total_num += Caclue_Day(1, day2, month2);
            }      
        }
        else{
            //不同年份
            //1、先计算两者相差整年份的收益
            total_num += Caclue_Year(year1 + 1, year2 - 1);
            //2、year1年份不足一年整月份的收益
            total_num += Caclue_Month(month1 + 1, 12, year1);
            //3、year2年份不足一年整月份的收益
            total_num += Caclue_Month(1, month2 - 1, year2);
            //4、year1中首月不足一月的收益
            total_num += Caclue_Day(day1, totalday[month1 - 1], month1);
            //5、year2中尾月不足一月的收益
            total_num += Caclue_Day(1, day2, month2); 
        }
        
        //输出
        cout << total_num << endl;
    }
}

 

你可能感兴趣的:(笔试强训,网络)