AcWing 4402. 刷题统计
原题链接
简单
作者:
YMYS
,
2024-04-11 21:02:19
,
所有人可见
,
阅读 15
//2024.4.11
//https://www.acwing.com/file_system/file/content/whole/index/content/10767639/
//刷题统计
/*
思路:我们发现暴力算法的【while(sum<n)】中sum每次都在重复的减去【5*a+2*b】,所以我们预先将此种情况处理掉即可
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int main() {
LL a, b, n, ret;
cin >> a >> b >> n;
//至少花费多少周
LL week = n / (a * 5 + b * 2);
n -= (a * 5 + b * 2) * week;//剩余做题量所耗费的时间不会超过一周
ret = week * 7;
for (int i = 0; i < 5 and n > 0; i++) ret++, n -= a;
for (int i = 0; i < 2 and n > 0; i++) ret++, n -= b;
cout << ret << endl;
return 0;
}
/*
//蓝桥官网过60%
#include<bits/stdc++.h>
#define int long long
using namespace std;
typedef pair<int, int> PII;
int a,b,n;
int sum;
int dd;//天数
signed main()
{
cin>>a>>b>>n;
while(sum<n){
for(int i=0;i<5;i++){
sum += a;
dd++;
if(sum>=n){
cout<<dd<<endl;
return 0;
}
}
for(int i=0;i<2;i++){
sum+=b;
dd++;
if(sum>=n){
cout<<dd<<endl;
return 0;
}
}
}
}
*/