A62780. 阅读程序(程序输入不超过数组或字符串定义的范围;判断题正确填√,错误填×;除特殊说明外,判断题1.5分,选择题3分)#include <cstdio>
编程题
知识点
题目描述
阅读程序(程序输入不超过数组或字符串定义的范围;判断题正确填√,错误填×;除特殊说明外,判断题1.5分,选择题3分)
#include <cstdio>
#include <cstring>
#include <algorithm>
inline int gcd(int a, int b){
if(b==0) return a;
return gcd(b, a%b);
}
int main(){
int n;
scanf("%d", &n);
int ans=0;
for (int i=1; i<=n; ++i){
for(int j=i+1; j<=n; ++j){
for(int k=j+1; k<=n; ++k){
if(gcd(i,j)==1 && gcd(j,k)==1 && gcd(i,k)==1){
++ans;
}
}
}
}
printf("%d\n", ans);
return 0;
}