之后一定是会更新的,更新的题目来源于我做过的codeforces,atcode,newcode,洛谷.
为了不让分享过于冗长,这里题目就直接发链接了,因为文章过长容易劝退.
我估摸着,大概会有30来道题吧,如果题型相似的话我就把归于一类,就算一题,如果有必要的知识点,会将知识点及扩展点列出供自己和大家学习.
不过还是以刷题为主.
题目一 >>> https://www.acwing.com/problem/content/description/4959
题名:冶炼金属.
看起来复杂的文字与字母的交错的文章,其实就想说下取整得到的结果
#include <iostream>
#include <algorithm>
#include <cmath>
#define int long long
using namespace std;
int a,b,n;
signed main()
{
cin >> n ;
int minnum = 0, maxnum = 1e9;
while(n--)
{
cin >> a >> b;
minnum = max(minnum,a/(b+1) + 1);
maxnum = min(maxnum,a/b);
}
cout << minnum << " " << maxnum << endl;
return 0;
}
题目二:
出自牛客网 >>> https://ac.nowcoder.com/acm/contest/76652/A
long long一定要开,而且这个公式当成常识记忆或者推导出来;
#include <iostream>
#include <algorithm>
#include <cmath>
#define int long long
using namespace std;
signed main()
{
int n;cin >> n;
int sum = n * (n + 1) / 2;
int anx = 1;
for(int i = 1 ; i <= n ; i++)
{
anx *= i;
if(anx > sum)
anx %= sum;
}
cout << __gcd(sum,anx) << "\n";
return 0;
}
!!!!!
突然意识到一个错误,例题一的最下边那行紫色笔写的”样例模拟”很不严谨,正确的应该是:总会有一个最大的数,与达成的(B+1)的V是相差1的,就跟样例的 59 - 2 一个道理