A:

题意:找到[a, b]的最大公约数;

思路:相同时为本身,不同时为1.

套路:碰到水题别想太多;

猜想:两个相邻数,必有一奇一偶,如果偶数有因子3或者其他,奇数可不可能有相同的呢?

   枚举一些数后发现没有,出现的奇数全是素数。

 

 1 #include <iostream>
 2 #include <algorithm>
 3 #include <stdlib.h>
 4 #include <time.h>
 5 #include <cmath>
 6 #include <cstdio>
 7 #include <string>
 8 #include <cstring>
 9 #include <vector>
10 #include <queue>
11 #include <stack>
12 #include <set>
13 
14 #define c_false ios_base::sync_with_stdio(false); cin.tie(0)
15 #define INF 0x3f3f3f3f
16 #define INFL 0x3f3f3f3f3f3f3f3f
17 #define zero_(x,y) memset(x , y , sizeof(x))
18 #define zero(x) memset(x , 0 , sizeof(x))
19 #define MAX(x) memset(x , 0x3f ,sizeof(x))
20 #define swa(x,y) {LL s;s=x;x=y;y=s;}
21 using namespace std ;
22 typedef long long LL;
23 const int N = 205;
24 
25 char n[N], m[N];
26 
27 int main(){
28     //freopen("in.txt","r",stdin);
29     //freopen("out.txt","w",stdout);
30     //ios_base::sync_with_stdio(false); cin.tie(0);
31     scanf("%s%s", n, m);
32     string n1, m1;
33     n1 = n; m1 = m;
34     if(n1 == m1) printf("%s\n", n);
35     else printf("1\n");
36     return 0;
37 }
View Code

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2021-08-12
  • 2021-04-24
  • 2021-12-04
  • 2021-11-19
猜你喜欢
  • 2022-12-23
  • 2021-08-14
  • 2022-02-01
  • 2021-06-25
  • 2022-01-17
  • 2021-10-29
  • 2021-08-18
相关资源
相似解决方案