-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathecnuoj3043.cpp
55 lines (55 loc) · 1.21 KB
/
ecnuoj3043.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include<stdio.h>
int gcd(int a, int b)
{
int p=0;
int q=0;
if(a>=b)
{
p=a;
q=b;
}
else
{
p=b;
q=a;
}
int temp=0;
while (p%q!=0)
{
temp=p%q;
p=q;
q=temp;
}
return q;
//TODO: your definition
}
/*/////////////////////////////////////////////////////*/
/***************************************************************/
/* */
/* DON'T MODIFY THIS FILE ANYWAY! */
/* */
/***************************************************************/
#include <stdio.h>
//********** Specification of gcd **********
int gcd(int a, int b);
/* PreCondition:
a and b are integers ranging from 1 to 1000,000,000
PostCondition:
return the greatest common divisor of a and b
*/
void solve()
{
int a,b; scanf("%d%d",&a,&b);
//********** gcd is called here **********
printf("%d\n",gcd(a,b));
//****************************************
}
int main()
{ int i,t;
scanf("%d\\n",&t);
for (i=0;i<t;i++)
{ printf("case #%d:\n",i);
solve();
}
return 0;
}