当前位置:网站首页>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...
边栏推荐
- Swagger2 knife4j NullPointerException 空指针问题
- 转行做程序员,从月薪5k到30k,45岁测试员道出了一路的心酸
- 小心使用C语言realloc()函数!!!
- 推荐一些面向 Web 开发者的杀手级网站
- Anatomy of Storage Size, Value Range, and Output Format of Basic Data Types in C Language
- 2022钉钉杯A题思路及代码:银行卡电信诈骗危险预测
- 第一章:GEE 和 GEEMAP
- 2. Creating Interactive Maps
- Nacos Jaspyt配置加密设置
- 动态内存管理,触及本质的最详解析
猜你喜欢
随机推荐
苹果开发者账号 申请 D-U-N-S 编号
C语言分支语句if,switch语句详细讲解
学编程的第五天
如何设置边框圆角
网络——IPV4地址(三)
Two ways to find the factorial of n
自定义过滤器和拦截器实现ThreadLocal线程封闭
SQL抖音面试题:送你一个万能模板,要吗?(重点、每个用户每月连续登录的最大天数)
Chapter 2: Creating Interactive Maps (2.4-2.6)
网络——数字数据编码
第三章:GEE数据的使用(3.1-3.3)
深究equals
resubmit 渐进式防重复提交框架简介
The second chapter: create an interactive map (2.1 2.3)
学编程的第六天
经典题型(一)
Chapter 3: Use of GEE Data (3.4-3.11)
网络——局域网和广域网
Redis学习(一.redis中的数据结构)
2. Creating Interactive Maps