Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
92467 梁敖铭 最简真分数 C++ Compile Error 0 MS 0 KB 471 2024-10-05 08:58:50

Tests(0/0):


Code:

#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", &n) != -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; }


Run Info:

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:13:22: error: 'n' was not declared in this scope
  while (scanf("%d", &n) != -1) {
                      ^
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]);
                     ^