| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 133490 | 陈华仁星 | 最大公约数(函数) | C++ | Compile Error | 0 MS | 0 KB | 286 | 2025-10-18 21:32:01 |
#include <iostream> #include <cmath> using namespace std; int top(int a,b) { int num; for(int i=2;i<=max(a,b);i++) { if(a%i==0&&b%i==0&&i>num) { num=i; } } return num; } int main() { int a,b; scanf("%d%d",&a,&b); printf("%d",top(a,b)); return 0; }
Main.cc:4:15: error: 'b' has not been declared
int top(int a,b)
^
Main.cc: In function 'int top(int, int)':
Main.cc:7:23: error: 'b' was not declared in this scope
for(int i=2;i<=max(a,b);i++)
^
Main.cc: In function 'int main()':
Main.cc:19:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d",&a,&b);
^