1 条题解
-
0
C :
#include <stdio.h> #include <stdlib.h> #include <string.h> int gcd(int x,int y) { return y==0?x:gcd(y,x%y); } int main() { int a,b; scanf("%d%d",&a,&b); printf("%d",gcd(a,b)); return 0; }
C++ :
#include<cstdio> using namespace std; int gcd(int xx,int yy) { if(xx==0) return yy; else return gcd(yy%xx,xx); } int main() { int a,b,t; scanf("%d%d",&a,&b); printf("%d\n",gcd(a,b)); return 0; }
Pascal :
Program ygjngerb; var a,b:integer; function f(a,b:integer):integer; var i:integer; begin f:=0; for i:=b downto 1 do if (a mod i=0) and (b mod i=0) and (i>f) then f:=i; if (f=1) then f:=5; end; begin read(a,b); write(f(a,b)); end.
- 1
信息
- ID
- 2940
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者