#include <iostream>
using namespace std;
class Integer {
private:
int _num;
public:
//构造函数
Integer(int num) {
_num = num;
}
//计算当前Integer 和 b之间的最大公约数
int gcd(Integer b) {
int r=b._num;
while (r != 0)
{
r = _num%b._num;
_num = b._num;
b._num = r;
}
return _num;
}
};
int main(){
int a, b;
cin >> a >> b;
Integer A(a);
Integer B(b);
cout << A.gcd(B) << endl;
return 0;
}
/* students please write your program here */
#include <iostream>
using namespace std;
class Integer{
private:
int _num;
//getLength()函数获取_num长度
int getLength(){
int len=1;
int n = _num;
while (n / 10 != 0)
{
++len;
n /= 10;
}
return len;
}
public:
//Integer类构造函数
Integer(int num){
_num = num;
}
//反转_num
int inversed(){
int len = getLength();
int tmp = _num;
int s = 0;
for (int i = 0; i < len; i++)
{
s = s * 10 + tmp % 10;
tmp /= 10;
}
return s;
}
};
int main() {
int n;
cin >> n;
Integer integer(n);
cout << integer.inversed() << endl;
}
/* students please write your program here */
#include <iostream>
#include <cmath>
using namespace std;
class Equation{
private:
int _a, _b, _c,_x;
public:
Equation(int a, int b, int c){
_a = a;
_b = b;
_c = c;
_x = _b*_b - 4 * _a*_c;
}
void solve(){
if (_x > 0 && _a != 0)
{
cout << 1 << endl;
double x = -_b / 2.0 / (double)_a;
double y = sqrt(_x) / 2.0 / (double)_a;
printf("%.2f %.2f\n", x - y, x + y);
}
else if (_x == 0 && _a != 0)
{
cout << 2 << endl;
double x = -_b / 2.0 / (double)_a;
printf("%.2f\n", x);
}
else if (_x<0 && _a != 0)
{
cout << 3 << endl;
}
else if (_a == 0 && _b == 0 && _c != 0)
{
cout << 4 << endl;
}
else if (_a == 0 && _b == 0 && _c == 0)
{
cout << 5 << endl;
}
else if (_a == 0 && _b != 0)
{
cout << 6 << endl;
double x = -_c / (double)_b;
printf("%.2f\n", x);
}
}
};
int main(){
int a, b, c;
cin >> a >> b >> c;
Equation tmp(a, b, c);
tmp.solve();
}