蓝桥杯基础题第一次记录

阅读 79

2022-04-06

🐾小喵简介:

💝博客主页:喵喵啃馒头

👏年龄:21岁 大三在读

✨爱好:记录美好 干饭 追剧 虽然很菜但每天都要进步一点点

第一篇代码日记🎈

#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int year = 0;
    for(int i=1000; i<=9999 ;i++)
    {
        int a = i / 1000;
        int b = i / 100 % 10;
        int c = i / 10 % 10;
        int d = i % 10;
        if (a == c && d - b == 1)
            year++;
    }
    cout<<year<<endl;
    return 0;
 } 

精彩评论(0)

0 0 举报