| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 84298 | 陈俊洁 | 最大公约数(函数) | C++ | Compile Error | 0 MS | 0 KB | 325 | 2024-07-15 15:08:10 |
#include<bits/stdc++.h> using namespace std; int gcd(int n,int m){ for(int i=n;i>0;i--){ if(n%i==0&&m%i==0){ return i; } } } int gcd2(int n;int m){ int c=n%m; while(c!=0){ n=m; m=c; c=n%m; } return m; } int main(){ int a,b; cin>>a>>b; cout<<gcd(a,b)<<endl; cout<<gcd2(a,b)<<endl; }
Main.cc:10:15: error: expected ')' before ';' token
int gcd2(int n;int m){
^
Main.cc:10:21: error: expected initializer before ')' token
int gcd2(int n;int m){
^
Main.cc: In function 'int gcd(int, int)':
Main.cc:9:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^