3月12日每日练习
3月12日每日练习
1.刷题统计
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> PII;
const int N = 1e5 + 10;
const int mod = 1e7 + 9;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
ll a, b, n;
cin >> a >> b >> n;
ll w = a * 5 + 2 * b; // 一周刷题数
ll x = n % w, y = n / w;
ll ans = y * 7;
if (x <= 5 * a)
{
ans += (x + a - 1) / a;
}
else
{
x -= 5 * a;
ans += 5;
if (x > b)
{
ans += 2;
}
else
{
ans += 1;
}
}
cout << ans;
return 0;
}
2.冶炼金属
由题意得:能炼出b个金属但炼不出b+1个
因此
b×v ≤ a 且 a <(b+1)×v
a/(b+1) < v ≤ a/b
最小值:a/(b+1) + 1(因为不能冶炼出b+1个金属所以+1)
最大值:a/b
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> PII;
const int N = 1e5 + 10;
const int mod = 1e7 + 9;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
ll n;
cin>>n;
ll mx=1e9,mi=0;
while (n--)
{
ll a,b;
cin>>a>>b;
ll x=(a/(b+1))+1,y=a/b;
mi=max(mi,x),mx=min(mx,y);
}
cout<<mi<<" "<<mx;
return 0;
}
3.Farmer John's Cheese Block B
将三维空间拆分为[x,y],[x,z],[y,z]三个二维平面,在一个二维平面的同一个点挖取n次,即可放入一个长度为n的奶酪
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> PII;
const int N = 1e5 + 10;
const int mod = 1e7 + 9;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
ll n, q;
cin >> n >> q;
vector<vector<ll>> a(n + 1, vector<ll>(n + 1));
vector<vector<ll>> b(n + 1, vector<ll>(n + 1));
vector<vector<ll>> c(n + 1, vector<ll>(n + 1));
ll res = 0;
while (q--)
{
ll x, y, z;
cin >> x >> y >> z;
a[x][y]++;
b[x][z]++;
c[y][z]++;
if (a[x][y] >= n)
{
res++;
}
if (b[x][z] >= n)
{
res++;
}
if (c[y][z] >= n)
{
res++;
}
cout << res << endl;
}
return 0;
}

3月12日每日练习
浙公网安备 33010602011771号