AD 2020

AD 2020
先预处理年份
再处理边边角角
模拟难度+++
很细的一个题

#include <bits/stdc++.h>
using namespace std;

#define endl "\n"

int num[10005], y1, m1, d1, y2, m2, d2;

int checkY(int y) {
    if (y / 1000 == 2 && y / 100 % 10 == 0 && y / 10 % 10 == 2) return 1;
    if (y / 100 % 10 == 2 && y / 10 % 10 == 0 && y % 10 == 2) return 1;
    return 0;
}

int checkLeap(int y) {return (y % 4 == 0 && y % 100 != 0) || y % 400 == 0;}

void init() {
    for (int i = 2000; i <= 9999; ++i) 
	{
        if (checkY(i))  num[i] = 365 + checkLeap(i); 
        else if (i % 10 == 2) num[i] = 29 + checkLeap(i);
        else num[i] = 2;
        num[i] += num[i - 1];
    }
}

int add(int y, int m, int d) 
{
    int res = 0;
    if (checkY(y)) {
        for (int i = 1; i < m; ++i) {
            if (i == 1 || i == 3 || i == 5 || i == 7 || i == 8 || i == 10) res += 31;
            else if (i == 2) res += 28 + checkLeap(y);
            else res += 30;
        }
        res += d;
        return res;
    }
    if (y % 10 == 2) {
        if (m > 2) res += 28 + checkLeap(y);
        if (m == 2) res += d;
        if (m == 12) res += (d >= 2);
        return res;
    }
    if (m > 2) res += 1;
    if (m == 2) res += (d >= 2);
    if (m == 12) res += (d >= 2);
    return res;
}

void solve() {
    int ans = 0;
    cin >> y1 >> m1 >> d1 >> y2 >> m2 >> d2;
    ans = num[y2 - 1] - num[y1 - 1];
    // 为什么要加上 y1这年一直到y2的上一年呢
    // 因为可以用add函数求出 从每一年开始到这个日期中 存在202的日子
    // 都是求上半部分,具有相似性
    ans += add(y2, m2, d2) - add(y1, m1, d1);
    if (checkY(y1) || (y1 % 10 == 2 && m1 == 2) || (m1 == 2 && d1 == 2) || (m1 == 12 && d1 == 2)) ans += 1;
    cout << ans << endl;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);cout.tie(nullptr);
    init();
    int _T;
    cin >> _T;
    while (_T--) solve();
    return 0;
}

03-26
<think>好的,我现在需要帮助用户查找与“AD2020”相关的技术文档、教程和配置信息。首先,用户提到的“AD2020”可能是指Active Directory在2020年的更新或相关技术内容。不过,根据提供的引用资料,用户可能对Azure Active Directory(Azure AD)更感兴趣,因为引用中多次提到Azure AD的集成和管理。 首先,我要确认用户的需求是否涉及本地Active Directory还是Azure AD。由于引用内容主要集中在Azure AD,比如域服务、组策略管理、单点登录(SSO)集成等,因此推测用户可能需要与Azure AD相关的2020年技术资料。接下来,我需要检查提供的引用内容是否有直接提到2020年的内容,但根据给出的引用,引用1到5都没有明确的时间标记,但引用的内容涉及Azure AD的常规配置和管理,这可能包括2020年的更新。 接下来,需要根据现有引用推荐相关资源。例如,引用1讨论了在Azure AD域服务中管理组策略,这可能与AD2020相关。引用3和4涉及单点登录的配置,这可能也是用户需要的。引用5提到了使用Spring Boot连接LDAP,这可能与本地AD或Azure AD集成有关。 用户可能需要了解2020年左右Azure AD的新功能或配置方法。考虑到这一点,我应该建议用户查阅微软官方文档,特别是2020年发布的更新,例如Azure AD的新功能、组策略管理改进或SSO集成的增强功能。此外,引用中的教程,如Hightail和Contentful的集成,可能展示了2020年常见的集成方法。 另外,用户可能需要具体的配置步骤或代码示例,比如使用Spring Boot连接LDAP(如引用5所示),或者配置自动化登录(如引用4)。因此,在回答中应包含这些相关引用,并引导用户到具体文档。 最后,生成相关问题需要考虑用户可能进一步询问的内容,如新特性、迁移指南或安全设置,因此需要准备相关问题,帮助用户深入探索。</think>根据您提到的“AD2020”和引用内容,推测您可能关注与 **Azure Active Directory(Azure AD)** 相关的技术文档或配置方法(尤其是2020年前后的更新或实践)。以下是整理后的技术资源和配置指引: --- ### 一、Azure AD 核心功能与配置 1. **组策略管理** Azure AD 域服务支持通过组策略(GPO)集中管理托管域中的虚拟机或应用配置。例如: - 创建自定义组织单位(OU)并应用组策略 - 配置密码策略或用户权限分配 - 引用示例:[^1]中详细说明了如何通过管理中心创建和链接GPO。 2. **单点登录(SSO)集成** 将第三方应用(如Contentful、Hightail)与Azure AD集成,实现统一身份认证: - 使用SAML或OAuth 2.0协议配置SSO - 引用示例:[^3]展示了为Contentful配置SSO的完整流程;[^2]描述了Hightail与Azure AD的集成步骤。 3. **自动化用户登录** 通过LDAP或SAML实现应用自动登录,例如引用[^4]中提到的iSAMS系统集成,用户可直接用Azure AD账户登录。 --- ### 二、代码级配置示例 若需通过代码连接Azure AD或本地AD,可参考以下实践: #### 1. Spring Boot连接LDAP(适用于混合环境) 引用[^5]提供了基于`spring-boot-starter-data-ldap`的配置: ```yaml spring: ldap: urls: ldaps://your-ldap-server:636 base: "DC=adgamioo,DC=com" username: user001@gamioo.com password: ********* ``` 此配置适用于连接支持LDAPS协议的AD服务器,实现用户查询或认证。 #### 2. PowerShell管理Azure AD ```powershell # 安装Azure AD模块 Install-Module AzureAD # 连接租户 Connect-AzureAD # 创建新用户 New-AzureADUser -DisplayName "Test User" -UserPrincipalName "test@domain.com" ``` --- ### 三、推荐学习资源 1. **微软官方文档** - [Azure AD 2020年新增功能](https://docs.microsoft.com/azure/active-directory/fundamentals/whats-new#2020) - [混合身份管理指南](https://docs.microsoft.com/azure/active-directory/hybrid/) 2. **实践教程** - [从本地AD迁移到Azure AD的步骤](https://docs.microsoft.com/azure/active-directory/cloud-sync/what-is-cloud-sync) - [条件访问策略配置](https://docs.microsoft.com/azure/active-directory/conditional-access/overview) ---
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值