#include<iostream>usingnamespace std;boolcheck(int x){while(x){int t = x %10;if(t ==2|| t ==0|| t ==1|| t ==9)returntrue;
x /=10;}returnfalse;}intmain(){longlong sum =0;// 请在此输入您的代码for(int i =1; i <=2019; i ++){if(check(i)) sum += i * i;}
cout << sum << endl;return0;}
数列求值
#include<iostream>usingnamespace std;intmain(){// 请在此输入您的代码int a =1, b =1, c =1;for(int i =4; i <=20190324; i ++){int t =(a + b + c)%10000;
a = b, b = c, c = t;}
cout << c << endl;return0;}
B组
门牌制作
#include<iostream>usingnamespace std;intget(int x){int res =0;while(x){
res += x %10==2;
x /=10;}return res;}intmain(){// 请在此输入您的代码int cnt =0;for(int i =1; i <=2020; i ++){
cnt +=get(i);}
cout << cnt << endl;return0;}
既约分数
#include<iostream>usingnamespace std;intgcd(int a,int b){return b ?gcd(b, a % b): a;}intmain(){// 请在此输入您的代码int cnt =0;for(int i =1; i <=2020; i ++)for(int j =1; j <=2020; j ++)if(gcd(i, j)==1) cnt ++;
cout << cnt << endl;return0;}