lanqiao 2098 刷题统计(数学优化)
This commit is contained in:
24
13lanqiao/test3-2.cpp
Normal file
24
13lanqiao/test3-2.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
// lanqiao 2098 刷题统计(数学优化)
|
||||
#include<bits/stdc++.h>
|
||||
using namespace std;
|
||||
#define int long long
|
||||
signed main(){
|
||||
int a, b, n; cin >> a >> b >> n;
|
||||
int d = 5 * a + 2 * b;
|
||||
if(n % d == 0) cout << (n/d)*7 << endl;
|
||||
else{
|
||||
int r = n % d, sum = 0;
|
||||
for(int i = 1; i <= 7; i++){
|
||||
if(i <= 5) sum += a;
|
||||
else sum += b;
|
||||
if(sum >= r){
|
||||
cout << (n/d)*7 + i << endl;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/* test samples -> 8
|
||||
10 20 99
|
||||
*/
|
||||
Reference in New Issue
Block a user