洛谷P1372又是毕业季(简单数论,找规律)

题目链接:https://www.luogu.org/problemnew/show/P1372

读题后,总结出来题意就是:找k个数,使这k个数的最大公约数最大。

题目看上去吓死人,但试试样例再找几个简单例子试试发现是有规律的,就是n/k!简单的数论水题一道。

 1 #include <iostream>
 2 #include <string>
 3 #include <algorithm>
 4 #include <iomanip>
 5 #include <cstdio>
 6 #include <cstring>
 7 #include <cmath>
 8 using namespace std;
 9 typedef long long ll;
10 typedef unsigned long long ull;
11 const int maxn=1e6+5;
12 int a[maxn];
13 int n,k;
14 
15 int main()
16 {
17     ios::sync_with_stdio(false); cin.tie(0);
18 
19     cin>>n>>k;
20 
21     cout<<n/k<<endl;
22 
23 
24     return 0;
25 }

完。

原文地址:https://www.cnblogs.com/redblackk/p/9786911.html