VP时间
A.数学
设为ans
赢得为+,输的为-。
0=ans+sum;
1.ac
B.贪心
比较大小
找到最优解
min(p*n,b[i]*n);
结构体排序(从小到大)cmp(费用最小,可以转播最多人)
如果费用大于等于p就让本人通知费用更低
1.wa2
2.wa15
3.ac
C.数学
a[i]=a[i+1]modi;
如果a[i+1]是i的倍数那k==2
k-分界点
分界点就是余数发生变化
k最多为3
1.ac
D.
没思路
题解
A.
// Problem: A. Goals of Victory
// Contest: Codeforces - Codeforces Round 902 (Div. 2, based on COMPFEST 15 - Final Round)
// URL: https://codeforces.com/contest/1877/problem/A
// Memory Limit: 256 MB
// Time Limit: 1000 ms
//
// Powered by CP Editor (https://cpeditor.org)
//へ /|
// /\7 ∠_/
// / │ / /
// │ Z _,< / /`ヽ
// │ ヽ / 〉
// Y ` / /
// イ● 、 ● ⊂⊃〈 /
// () へ | \〈
// >ー 、_ ィ │ //
// / へ / ノ<| \\
// ヽ_ノ (_/ │//
// 7 |/
// >―r ̄ ̄`ー―_
#include <iostream>
#include <cstring>
#include <iomanip>
#include <ctime>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <queue>
#define eps 1e-5
#define INF 1e9
using namespace std;
typedef long long ll;
const int N = 2e6 + 9;
int a[N];
void solve() {
int n;
cin>>n;
int sum=0;
for(int i=1;i<=n-1;i++){
cin>>a[i];
sum+=a[i];
}
int ans=0-sum;
cout<<ans<<'\n';
}
int main() {
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int q;
cin >> q;
while (q--) {
solve();
}
return 0;
}
B.
// Problem: B. Helmets in Night Light
// Contest: Codeforces - Codeforces Round 902 (Div. 2, based on COMPFEST 15 - Final Round)
// URL: https://codeforces.com/contest/1877/problem/B
// Memory Limit: 256 MB
// Time Limit: 1000 ms
//
// Powered by CP Editor (https://cpeditor.org)
//へ /|
// /\7 ∠_/
// / │ / /
// │ Z _,< / /`ヽ
// │ ヽ / 〉
// Y ` / /
// イ● 、 ● ⊂⊃〈 /
// () へ | \〈
// >ー 、_ ィ │ //
// / へ / ノ<| \\
// ヽ_ノ (_/ │//
// 7 |/
// >―r ̄ ̄`ー―_
#include <iostream>
#include <cstring>
#include <iomanip>
#include <ctime>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <queue>
#define eps 1e-5
#define INF 1e9
using namespace std;
typedef long long ll;
const int N = 2e6 + 9;
struct node{
int num,spend;
}a[N];
bool cmp(node a, node b){
if(a.spend!=b.spend){
return a.spend<b.spend;
}else{
return a.num>b.num;
}
}
void solve() {
ll n,p;
cin>>n>>p;
for(int i=1;i<=n;i++){
cin>>a[i].num;
}
for(int i=1;i<=n;i++){
cin>>a[i].spend;
}
sort(a+1,a+1+n,cmp);
ll ans=0;
ll sum=n;
if(a[1].spend>=p){
cout<<n*p<<'\n';
return;
}else{
sum--;
for(int i=1;i<=n;i++){
if(a[i].spend>=p){
ans+=sum*p;
cout<<ans+p<<'\n';
return;
}else{
if(sum>a[i].num){
ans+=a[i].spend*a[i].num;
sum-=a[i].num;
}else{
ans+=a[i].spend*sum;
break;
}
}
}
ans+=p;
}
cout<<ans<<'\n';
}
int main() {
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int q;
cin >> q;
while (q--) {
solve();
}
return 0;
}
C.//
// Problem: C. Joyboard
// Contest: Codeforces - Codeforces Round 902 (Div. 2, based on COMPFEST 15 - Final Round)
// URL: https://codeforces.com/contest/1877/problem/C
// Memory Limit: 256 MB
// Time Limit: 1000 ms
//
// Powered by CP Editor (https://cpeditor.org)
//へ /|
// /\7 ∠_/
// / │ / /
// │ Z _,< / /`ヽ
// │ ヽ / 〉
// Y ` / /
// イ● 、 ● ⊂⊃〈 /
// () へ | \〈
// >ー 、_ ィ │ //
// / へ / ノ<| \\
// ヽ_ノ (_/ │//
// 7 |/
// >―r ̄ ̄`ー―_
#include <iostream>
#include <cstring>
#include <iomanip>
#include <ctime>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <queue>
#define eps 1e-5
#define INF 1e9
using namespace std;
typedef long long ll;
void solve() {
ll n,m,k;
cin>>n>>m>>k;
if(k>3){
cout<<0<<'\n';
}else{
if(k==1){
cout<<1<<'\n';
}else if(k==2){
if(m<=n){
cout<<m<<'\n';
}else{
cout<<n+m/n-1<<'\n';
}
}else{
if(m<=n){
cout<<0<<'\n';
}else{
cout<<(m/n-1)*(n-1)+m%n<<'\n';
}
}
}
}
int main() {
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int q;
cin >> q;
while (q--) {
solve();
}
return 0;
}