Good Bye 2023(A被hack,状态不好)

A.输出一堆1,然后输出2023/ans,ans*=b[i];得开LL(暴躁)

// Problem: A. 2023
// Contest: Codeforces - Good Bye 2023
// URL: https://codeforces.com/contest/1916/problem/0
// 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;
ll a[N],b[N];
void solve() {
	ll n,k;
	cin>>n>>k;
	for(int i=1;i<=n;i++){
		cin>>b[i];
	}
	ll ans=1;
	for(int i=1;i<=n;i++){
		ans*=b[i];
	}
	if(2023%ans==0){
		cout<<"YES"<<'\n';
		for(ll i=1;i<=k-1;i++){
			cout<<1<<" ";
		}
		cout<<2023/ans<<'\n';
		return;
	}else{
		cout<<"NO"<<'\n';
	}
}
int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int q;
	cin >> q;
	while (q--) {
		solve();
	}

	return 0;
}

B.一眼看可能是最小公倍数,但是1,5,是25,因此把每个例子带一遍就知道是什么了.

ans*=b/a;

// Problem: B. Two Divisors
// Contest: Codeforces - Good Bye 2023
// URL: https://codeforces.com/contest/1916/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;
int a[N];
ll gcd(ll a, ll b){
	return b?gcd(b,a%b):a;
}
ll lcm(ll a,ll b){
	return a/gcd(a,b)*b;
}
void solve() {
	ll a,b;
	cin>>a>>b;
	ll ans=lcm(a,b);
	if(ans==b){
		ans*=b/a;
	}
	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.博弈得模拟,找到怎么变成最小值,怎么变成最大值,发现损失就在奇数和偶数.模拟一下过程可以发现,奇数+奇数=偶数,就可以没有损失,但是如果有3个奇数就可以发现,肯定会损失(-1),每3次(-1),如果还%3==1(也就是最后是奇数+偶数)(肯定会损失).

// Problem: C. Training Before the Olympiad
// Contest: Codeforces - Good Bye 2023
// URL: https://codeforces.com/contest/1916/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;
const int N = 2e6 + 9;
ll a[N];
void solve() {
	ll n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	ll sum=0;
	ll cnt=0;
	for(int i=1;i<=n;i++){
		sum+=a[i];
		if(a[i]&1){
			cnt++;
		}
		if(i==1){
			cout<<a[i]<<" ";
			continue;
		}
		ll del=cnt/3;
		if(cnt%3==1){
			del++;
		}
		cout<<sum-del<<" ";	
	}
	cout<<'\n';
}

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int q;
	cin >> q;
	while (q--) {
		solve();
	}

	return 0;
}

  • 9
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值