Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
92468 | 梁敖铭 | 最简真分数 | C++ | Compile Error | 0 MS | 0 KB | 470 | 2024-10-05 08:59:17 |
#include<stdio.h> using namespace std; int g(int a, int b) { if (b==0) { return a; } else { return gcd(b, a%b); } } int main() { int x; while (scanf("%d", &x) != -1) { if (x==0) { continue; } int r[x]; int c=0; for (int i=0; i<x; i++) { scanf("%d",&r[i]); } for (int i=0; i<x-1; i++) { for (int j=i+1; j<x; j++) { if (gcd(r[i],r[j])==1) { c++; } } } printf("%d\n",c); } return 0; }
Main.cc: In function 'int g(int, int)': Main.cc:7:20: error: 'gcd' was not declared in this scope return gcd(b, a%b); ^ Main.cc: In function 'int main()': Main.cc:24:22: error: 'gcd' was not declared in this scope if (gcd(r[i],r[j])==1) { ^ Main.cc:20:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&r[i]); ^