标签:nim rate name space ring 细节 ios int 比较
ans=r+d-r%d
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin>>n;
while(n--)
{
int l,r,d;
cin>>l>>r>>d;
if(d<l)
cout<<d<<"\n";
else
{
int k=r%d;
cout<<r+d-k<<"\n";
}
}
}
#include <bits/stdc++.h>
using namespace std;
int bk1[666666],bk2[666666],bk3[666666],bk4[666666],p1,p2,p3,p4,ans,sum,rt;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
string a;
cin>>a;
for(int i=0;i<a.size();i++)
{
if(a[i]==‘[‘)
bk1[p1++]=i;
if(a[i]==‘:‘)
bk2[p2++]=i;
if(a[i]==‘]‘)
bk3[p3++]=i;
}
for(int i=0;i<p2;i++)
if(bk2[i]>bk1[0]&&bk2[i]<bk3[p3-1])
ans++,bk4[p4++]=bk2[i];
if(ans<2||p1==0||p3==0)
return cout<<-1,0;
for(int i=p3-1;i>=0;)
{
if(bk4[p4-1]<bk3[i])
{
rt=bk4[p4-1];
break;
}
else
p4--;
}
for(int i=bk4[0];i<rt;i++)
if(a[i]==‘|‘)
sum++;
cout<<4+sum;
}
Educational Codeforces Round 58 (Rated for Div. 2) (前两题题解)
标签:nim rate name space ring 细节 ios int 比较
原文地址:https://www.cnblogs.com/baccano-acmer/p/10261253.html