当前位置:网站首页>Codeforces Round #808 (Div. 2)||Precipitation
Codeforces Round #808 (Div. 2)||Precipitation
2022-08-09 18:04:00 【Tao Terrence】
Codeforces Round #808 (Div. 2)
The whole question is more difficult 做的是div1 除AB不同以外 都是一样的 出题人%%%%,所以div1也只做到了B,Or bite the bullet and write the solution
A Difference Operations
This is a number thesis 稍微想一想 As long as the following number is a multiple of the first numberok了
#include<bits/stdc++.h>
using namespace std;
const int N=10005;
int a[N];
int main(){
int _;
scanf("%d",&_);
while(_--){
int n;
scanf("%d",&n);
for(int i=0;i<n;i++)
scanf("%d",&a[i]);
int flag=1;
for(int i=1;i<n;i++){
if(a[i]%a[0]!=0){
flag=0;
break;
}
if(a[i]==0){
for(int j=i;i<n;j++)
if(a[j]!=0){
flag=0;
break;
}
break;
}
}
if(flag)cout<<"YES\n";
else cout<<"NO\n";
}
return 0;
}
B Difference of GCDs
B question someone else's climb%%%%%%%%%%
#include<bits/stdc++.h>
using namespace std;
typedef int long long ll;
const int N=100010;
ll n,m,a[N];
ll sum,ans[N];
string str;
vector<int>vt;
void solve()
{
ll l,r;
cin>>n>>l>>r;
memset(ans,0,sizeof(ans));
bool flag=true;
for(int i=2;i<=n;i++)
{
int t=(l+i-1)/i;
int tt=r/i;
if(i*t*1ll>r||i*tt*1ll<l)
{
flag=false;
break;
}
ans[i]=i*t*1ll;
}
if(flag==false)
{
cout<<"No"<<'\n';
return;
}
ans[1]=l;
cout<<"YES"<<'\n';
for(int i=1;i<=n;i++)
{
cout<<ans[i]<<" ";
}
cout<<'\n';
}
int main(){
cin.tie(0);
ios::sync_with_stdio;
int t;
t=1;
cin>>t;
while(t--)
solve();
return 0;
}
c Doremy’s IQ
c的话 吃了四发 div1的AGet me out of my mind I finally found a hole later
Scan backwardsiq=0开始扫 ,能不变就不变,否则如果iq<q就++iq
Note the flipped answer at the end
In fact, I feel that this sample is more or less problematic..
啊对 The problem with binary toook的;
#include<bits/stdc++.h>
using namespace std;
const int N=100010;
int a[N];
int main(){
int _;
scanf("%d",&_);
while(_--){
int n,q;
scanf("%d%d",&n,&q);
for(int i=1;i<=n;++i)
scanf("%d",&a[i]);
int cc=0;
string ans="";
for(int i=n;i>=1;--i){
if(a[i]<=cc)ans+='1';
else if(a[i]>cc){
if(cc<q){
cc++;
ans+='1';
}
else{
ans+='0';
}
}
}
reverse(ans.begin(),ans.end());
cout<<ans<<'\n';
}
return 0;
}
D Difference Array
我的历程————什么题??oh a glanceB————啊不对 Isn't this a proper math problem?,我来模拟一下————再看看 I know it's not that simple————violent beating???————这tmhow violent??————look at the group————无人生还————This violence has to be sorted by layers. ————搞不明白————Friends let me carry0————The difference of each round seems to be able to jump a lot at the end0————明白了!
After creating the new array 会发现有一堆0,All we have to do is keep one0就ok了,因为是升序的,find the last one0,The first number after that is the first0The position or not0的第一个数的位置,Just follow up…It's still quite difficult 以后div2带div1no more,,,,)含泪
#include<bits/stdc++.h>
using namespace std;
signed main()
{
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int _;cin >> _;
while(_--){
int n;cin >> n;
vector<int> a;
int cnt = 0;
for(int i = 1; i <= n; ++i){
int num;cin >> num;
if(num)a.push_back(num);
else cnt++;
}
int cur = a.size();
while(1){
if(cur == 1 || cur == 0)break;
vector<int> b;
if(cnt){
b.push_back(a[0]);
cnt--;
}
for(int i = 0; i < cur - 1; ++i)
if(a[i + 1] - a[i])
b.push_back(a[i + 1] - a[i]);
else cnt++;
cur = b.size();
a = b;
sort(a.begin(),a.end());
if(cur == 1 || cur == 0)break;
}
if(cur == 0)cout << "0\n";
else cout << a[0] << '\n';
}
return 0;
}
终于写完了 再有div1and div2的联合roundnever fight again...
边栏推荐
猜你喜欢
随机推荐
1. Introducing GEE and Geemap
学习编程的第二天
智慧灯杆网关智慧交通应用
1. Introducing GEE and Geemap
真正入驻CSDN的第一天
map和set容器
Chapter 3: Use of GEE Data (3.4-3.11)
学习编程的第四天
苹果开发者账号 申请 D-U-N-S 编号
投入C语言
测试工作管理与规范
Excel相关处理工具类
一个程序员的水平能差到什么程度?
网络——数字数据编码
网络——数据交换方式
resubmit 渐进式防重复提交框架简介
Redis learning (1. Data structure in redis)
第二章:创建交互式地图(2.1-2.3)
文字样式的常见属性的如何使用?
【Web渗透】信息收集篇——Google搜索引擎(一)