代码:
#include<stdio.h>
int duanchu(int x, int y){
if(x==1||y==1) return 1;
while(x!=0&&y!=0){
if(x>y){
x=x%y;
if(x==1||x==0) return x;
}
else if(x<y){
y=y%x;
if(y==1||y==0) return y;
}
else return 0;
}
}
int main(){
int i=1,j=1,count=0;//count用来计数,一共有多少个
for(i=1; i<2021; i++){
for(j=1; j<2021; j++){
if(duanchu(i,j)==1) count++;
}
}
printf("%d",count);
return 0;
}