2 条题解

  • 1
    @ 2024-3-21 11:06:03
    #include <iostream>
    #include <cmath>
    using namespace std;
    int days[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    
    int main()
    {
    	int cnt = 0;
    	for(int i = 1; i <= 12; i ++ )
    	{
    		int a = i/10, b = i%10;
    		for(int j = 1; j <= days[i]; j ++ )
    		{
    			int c = j/10, d = j%10;
    			if((a + 1 == b && b + 1 == c) || (b + 1 == c && c + 1 == d))
    				cnt++;
    		}
    	}
    	cout<<cnt<<endl;
    }
    

    容易看出顺子和2022没有关系 直接枚举月日即可

    信息

    ID
    967
    时间
    1000ms
    内存
    256MiB
    难度
    2
    标签
    递交数
    153
    已通过
    55
    上传者