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;
}