A

#include<bits/stdc++.h>
using namespace std;
int main(){
int t;cin>>t;
while(t--){
int a[];
cin>>a[]>>a[]>>a[];
sort(a+,a+);
int ans=;
if(a[]+a[]<=a[])
ans=a[]+a[];
else {
ans = (a[]+a[]+a[])/;
}
cout<<ans<<'\n';
}
}

B

#include<bits/stdc++.h>
using namespace std; int n,a[],flag[];
int s[][]; int judge(int x){
for(int i=;i<=n;i++){
if(i==x)continue;
if(s[x][]==s[i][] && s[x][]==s[i][] &&s[x][]==s[i][] &&s[x][]==s[i][])
return ;
}
return ;
} int main(){
int t;cin>>t;
while(t--){
cin>>n;
for(int i=;i<=n;i++){
cin>>a[i];
s[i][]=a[i]%;
s[i][]=(a[i]%)/;
s[i][]=(a[i]%)/;
s[i][]=a[i]/;
flag[i]=i;
for(int j=;j<i;j++)
if(a[i]==a[j]){
flag[i]=j;
break;
}
}
int p=,cnt=;
for(int i=;i<=n;i++)if(flag[i]!=i){
cnt++;
while(){
s[i][]=p++;
if(judge(i))break;
}
} cout<<cnt<<'\n';
for(int i=;i<=n;i++)
cout<<s[i][]<<s[i][]<<s[i][]<<s[i][]<<'\n';
}
}

C

#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll n;
vector<ll>v;
int main(){
int t;cin>>t;
while(t--){
v.clear();
cin>>n;
v.push_back();
for(ll l=,r;l<=n;l=r+){
r=n/(n/l);
v.push_back(n/l);
}
sort(v.begin(),v.end());
cout<<v.size()<<'\n';
for(auto x:v)
cout<<x<<" ";
puts("");
}
}

D

#include<bits/stdc++.h>
using namespace std;
#define N 200006 int n,flag[N][],vis[];
char str[N][];
set<int>s[]; int F[];
int find(int x){
return F[x]==x?x:F[x]=find(F[x]);
} int main(){
int n;
cin>>n;
for(int i=;i<=n;i++){
scanf("%s",str[i]);
int len=strlen(str[i]);
for(int j=;j<len;j++)
flag[i][str[i][j]-'a']=vis[str[i][j]-'a']=;
for(int j=;j<;j++)
if(flag[i][j])s[j].insert(i);
} for(int i=;i<;i++)F[i]=i; for(int i=;i<;i++)if(vis[i]){
for(int j=;j<i;j++)if(find(i)!=find(j)){
vector<int>c;
c.clear();
set_intersection(s[i].begin(),s[i].end(),s[j].begin(),s[j].end(),back_inserter(c));
//交集不为空
if(c.size())
F[F[i]]=F[j];
}
}
int cnt=;
for(int i=;i<;i++)
if(find(i)==i && vis[i])cnt++;
cout<<cnt<<'\n';
}

E:这题感觉有个很大的坑

#include<bits/stdc++.h>
using namespace std;
#define N 2000005
int n;
char s[N],a[N]; #define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1 const int MAXN = 1e6+;
int add[MAXN<<],sl[MAXN<<],sr[MAXN<<]; void pushup(int root)
{
sl[root]=min(sl[root<<],sl[root<<|]);
sr[root]=max(sr[root<<],sr[root<<|]);
} void pushdown(int rt)
{
if(add[rt])
{
sl[rt<<]+=add[rt];
sl[rt<<|]+=add[rt]; sr[rt<<]+=add[rt];
sr[rt<<|]+=add[rt]; add[rt<<]+=add[rt];
add[rt<<|]+=add[rt];
add[rt]=;
}
} void update(int L,int R,int x,int l,int r,int rt)
{
if(l>=L && r<=R)
{
add[rt]+=x;
sl[rt]+=x;
sr[rt]+=x;
return;
}
pushdown(rt);
int m=(l+r)>>;
if(L<=m) update(L,R,x,lson);
if(R>m) update(L,R,x,rson);
pushup(rt);
} int main(){
cin>>n;
scanf("%s",s+);
int p=;
int cnt=;
for(int i=;i<=n;i++){
if(s[i]=='L'){
if(p>)
p--;
}
else if(s[i]=='R')
p++;
else {
if(a[p]=='('){
cnt--;
update(p,n,-,,n,);
}
else if(a[p]==')'){
cnt++;
update(p,n,,,n,);
}
if(s[i]=='('){
cnt++;
update(p,n,,,n,);
}
else if(s[i]==')'){
cnt--;
update(p,n,-,,n,);
} a[p]=s[i];
}
if(cnt!= || sl[]<)
cout<<"-1 ";
else cout<<sr[]<<" ";
}
/*puts("");
cout<<p<<'\n';
printf("%s",a+1);
*/
}
/*
(((aaa(R(RaR))R(R(a)))RRaLaa)LRaa(aR))(LaRR(a(a)LaR()R(RR)(RaRa(()aaLLLLL(a)(()R(()
*/

cf 1263的更多相关文章

  1. ORA-00494: enqueue [CF] held for too long (more than 900 seconds) by 'inst 1, osid 5166'

    凌晨收到同事电话,反馈应用程序访问Oracle数据库时报错,当时现场现象确认: 1. 应用程序访问不了数据库,使用SQL Developer测试发现访问不了数据库.报ORA-12570 TNS:pac ...

  2. cf之路,1,Codeforces Round #345 (Div. 2)

     cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅.....   ...

  3. cf Round 613

    A.Peter and Snow Blower(计算几何) 给定一个点和一个多边形,求出这个多边形绕这个点旋转一圈后形成的面积.保证这个点不在多边形内. 画个图能明白 这个图形是一个圆环,那么就是这个 ...

  4. ARC下OC对象和CF对象之间的桥接(bridge)

    在开发iOS应用程序时我们有时会用到Core Foundation对象简称CF,例如Core Graphics.Core Text,并且我们可能需要将CF对象和OC对象进行互相转化,我们知道,ARC环 ...

  5. [Recommendation System] 推荐系统之协同过滤(CF)算法详解和实现

    1 集体智慧和协同过滤 1.1 什么是集体智慧(社会计算)? 集体智慧 (Collective Intelligence) 并不是 Web2.0 时代特有的,只是在 Web2.0 时代,大家在 Web ...

  6. CF memsql Start[c]UP 2.0 A

    CF memsql Start[c]UP 2.0 A A. Golden System time limit per test 1 second memory limit per test 256 m ...

  7. CF memsql Start[c]UP 2.0 B

    CF memsql Start[c]UP 2.0 B B. Distributed Join time limit per test 1 second memory limit per test 25 ...

  8. CF #376 (Div. 2) C. dfs

    1.CF #376 (Div. 2)    C. Socks       dfs 2.题意:给袜子上色,使n天左右脚袜子都同样颜色. 3.总结:一开始用链表存图,一直TLE test 6 (1)如果需 ...

  9. CF #375 (Div. 2) D. bfs

    1.CF #375 (Div. 2)  D. Lakes in Berland 2.总结:麻烦的bfs,但其实很水.. 3.题意:n*m的陆地与水泽,水泽在边界表示连通海洋.最后要剩k个湖,总要填掉多 ...

随机推荐

  1. 【ABAP系列】SAP ABAP 物料凭证增强

    公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[ABAP系列]SAP ABAP 物料凭证增强 ...

  2. 学习:STL----优先队列

    优先队列是队列的高级版,最大的特点是可以内部实现排序 优先队列的定义 优先队列内部使用堆排序,从而实现队列内一直保持着某种顺序规律(比如递增,递减等) 在使用优先队列时,首先要引入头文件:#inclu ...

  3. Gradient Vanishing Problem in Deep Learning

    在所有依靠Gradient Descent和Backpropagation算法来学习的Neural Network中,普遍都会存在Gradient Vanishing Problem.Backprop ...

  4. GD Library extension not available

    在后台文章上传封面时,遇到了这样一个错误 GD Library extension not available with this PHP installation Ubuntu Nginx 自己在本 ...

  5. [Python3 填坑] 013 几个类相关函数的举例

    目录 1. print( 坑的信息 ) 2. 开始填坑 2.1 issubclass() 2.2 isinstance() 2.3 hasattr() 2.4 getattr() 2.5 setatt ...

  6. struts框架的一些注意点

    1.Struts.xml文件中<include file="">标签的运用 用法:此标签引用配置文件,Struts2提供了一个默认的struts.xml文件,当此配置文 ...

  7. Linux终端下简单的登录程序 密码不回显

    在Linux进行登录是输入密码不会被回显,所以我也写了个简单的登入程序,使得在输入密码时不再进行回显. #include <stdio.h> #include <stdlib.h&g ...

  8. canvas添加事件

    https://blog.csdn.net/xundh/article/details/78722744

  9. [已解决]报错: Error response from daemon: conflict

    报错内容: Error response from daemon: conflict: unable to delete f5b6ef70d79b (must be forced) - image i ...

  10. 最小公倍数(lcm与gcd)

    J - Worker Avin meets a rich customer today. He will earn 1 million dollars if he can solve a hard p ...