#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define lli long long int
using namespace std;
const lli MAXN=;
const lli INF=0x7ffff;
inline void read(lli &n)
{
char c=getchar();n=;bool flag=;
while(c<''||c>'') c=='-'?flag=,c=getchar():c=getchar();
while(c>=''&&c<='') n=n*+c-,c=getchar();n=flag==?-n:n;
}
lli n,m,s,k;
struct C
{
lli ID;
lli score;
}sj[MAXN];
bool how[MAXN];
lli ans=-;
lli impro[MAXN];
lli comp(const C &a,const C &b)
{
return a.score<b.score;
}
lli now=;
void pd()
{
memset(impro,,sizeof(impro));
for(lli i=;i<=m;i++)
if(how[i])
impro[sj[i].ID]+=(-sj[i].score);
for(lli i=;i<=n;i++)
if(impro[i]<k)
return ;
lli cur=;
for(lli i=;i<=n;i++)
cur+=impro[i];
ans=max(ans,cur);
}
void dfs(lli now,lli spend)
{
if(now==m+) { pd(); return ; }
if(spend<s)
{
how[now]=;
dfs(now+,spend+);// tou
how[now]=;
}
how[now]=;
dfs(now+,spend);//bu tou
}
void check()
{
ans=;
for(lli i=;i<=m;i++)
{
if(impro[sj[i].ID]<k&&sj[i].score<)
if(now<s)
{ impro[sj[i].ID]+=(-sj[i].score); now++;
ans+=(-sj[i].score); sj[i].score=INF; }
else
{ printf("-23333333"); exit(); }
else continue;
}
for(lli i=;i<=n;i++)
if(impro[i]<k)
{ printf("-23333333"); exit(); } sort(sj+,sj+m+,comp);
for(lli i=;i<=m;i++)
if(now<s&&sj[i].score!=INF&&sj[i].score<)
ans+=(-sj[i].score), now++;
printf("%lld",ans);
}
int main()
{
freopen("express.in","r",stdin);
freopen("express.out","w",stdout);
read(n);read(m);read(s);read(k);
for(lli i=;i<=m;i++)
{
read(sj[i].ID);read(sj[i].score);
sj[i].score=-sj[i].score;
}
if(n<=)
{
dfs(,);
if(ans==-) printf("-23333333");
else printf("%lld",ans);
}
else
{
sort(sj+,sj+m+,comp);
check();
}
return ;
}
 #include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
const int MAXN=;
inline void read(int &n)
{
char c=getchar();n=;bool flag=;
while(c<''||c>'') c=='-'?flag=,c=getchar():c=getchar();
while(c>=''&&c<='') n=n*+c-,c=getchar();n=flag==?-n:n;
}
string a;
void work(int bg,int ed)
{
string b; int now=;
for(int i=ed-;i>bg;i--)
if(a[i]=='(') b=b+')';
else if(a[i]==')') b=b+'(';
else b=b+a[i];
for(int i=bg+;i<ed;i++) a[i]=b[now++]; a[bg]='$';a[ed]='$';
}
int main()
{
freopen("unknown.in","r",stdin);
freopen("unknown.out","w",stdout);
cin>>a;
int la=a.length();
int now=;
int bg=,ed=;
while(a.find('(')!=a.npos)
{
for(int i=;i<a.length();i++)
{
if(a[i]=='(') { if(now==) bg=i; now++; }
if(a[i]==')') { if(now==) ed=i,work(bg,ed); now--; }
}
// cout<<a<<endl;
}
for(int i=;i<=a.length();i++)
if(a[i]!='$') cout<<a[i];
return ;
}
 #include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
const int MAXN=;
const int INF=;
inline void read(int &n)
{
char c=getchar();n=;bool flag=;
while(c<''||c>'') c=='-'?flag=,c=getchar():c=getchar();
while(c>=''&&c<='') n=n*+c-,c=getchar();n=flag==?-n:n;
}
int map[][];
int n,m,k;
int main()
{
freopen("prison.in","r",stdin);
freopen("prison.out","w",stdout);
read(n);read(m);read(k);
for(int i=;i<=m;i++)
{
int x,y;read(x);read(y);
map[x][y]=;map[y][x]=;
}
if(n==)
{
if(map[][])
{
if(k==) printf("");
else printf("");
}
else printf("");
}
else
{
printf("%d",rand()%n);
}
return ;
}

Day2代码的更多相关文章

  1. Python实例---模拟微信网页登录(day2)

    第三步: 实现长轮询访问服务器---day2代码 settings.py """ Django settings for weixin project. Generate ...

  2. 《30天自制操作系统》笔记3 --- (Day2 上节)完全解析文件系统

    Day2 汇编语言学习与Makefile入门 本文仅带着思路,研究源码里关于文件系统的参数 关于day2主程序部分及更多内容,请看<30天自制操作系统>笔记 导航 发现学习中的变化 源码差 ...

  3. bzoj 1879 状压dp

    879: [Sdoi2009]Bill的挑战 Time Limit: 4 Sec  Memory Limit: 64 MBSubmit: 852  Solved: 435[Submit][Status ...

  4. python 模块初识

    python的强大之处在于有丰富的实现各种功能的标准库和第三方库,另外还允许用户自己建立库文件, 标准模块(又称为库)包括sys, os, glob, socket, threading, _thre ...

  5. java day2一个模拟双色球的代码

    package day2; import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt ...

  6. 【NOIP2014】DAY2题解+代码

    T1 傻逼题……不想写贴昨年代码了. 总之随便怎么搞都能过. 15年的DAY2T1怎么那么毒瘤真是越活越倒退] #include <iostream> #include <fstre ...

  7. day-2 如何搭建一个github代码库

    最近在听尤瓦尔·赫拉利代写的两本书<人类简史>和<未来简史>两本书评,一部描述人类从哪里来,一部描述人类将往哪里去,书中阐述以前我们经历的饥饿.疾病和战争已经渐渐逝去,未来我们 ...

  8. 《从零开始学Swift》学习笔记(Day2)——使用Web网站编写Swift代码

    Swift 2.0学习笔记——使用Web网站编写Swift代码 原创文章,欢迎转载.转载请注明:关东升的博客 Swift程序不能在Windows其他平台编译和运行,有人提供了一个网站swiftstub ...

  9. 半夜删你代码队 Day2冲刺

    一.每日站立式会议 1.站立式会议 成员 昨日完成工作 今日计划工作 遇到的困难 陈惠霖 整理任务 了解相关网页设计 任务安排有的不合理,需改进 侯晓龙 学习了解相关知识 尝试写第一个实例子 无 周楚 ...

随机推荐

  1. oracle 11G 配置侦听文件

    lsnrctl status   130  2017-08-23 03:15:16 oracle cat /etc/hosts   131  2017-08-23 03:15:26 oracle ca ...

  2. GET和POST请求的核心区别

    GET请求具有幂等性,而POST请求没有.

  3. BNUOJ 34990 Justice String

    Justice String Time Limit: 2000ms Memory Limit: 65536KB 64-bit integer IO format: %lld      Java cla ...

  4. Qt之图形(组合)

    简述 使用QPainter绘制图形或者图像时,在重叠区域使用组合模式(Composition_mode).在绘图设备上通过组合模式使用QImage时,必须使用Format_ARGB32_Premult ...

  5. 从一次生产事故说起——linux的单用户模式,救援模式等等

    伴随着今年linux上面最大一个安全漏洞bash漏洞的出现,我们公司也開始了风风火火的漏洞修复工作,机器一多,也就easy出问题,有台64位的linuxserver一不小心就升级了32位 bash 的 ...

  6. hdoj 1719 Friend

    Friend Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Sub ...

  7. HDU4622:Reincarnation(后缀数组,求区间内不同子串的个数)

    Problem Description Now you are back,and have a task to do: Given you a string s consist of lower-ca ...

  8. angularjs 事件向上向下传播

    <!DOCTYPE HTML> <html ng-app="myApp"> <head> <meta http-equiv="C ...

  9. FPGA静态时序分析——IO口时序(Input Delay /output Delay)

    1.1  概述 在高速系统中FPGA时序约束不止包括内部时钟约束,还应包括完整的IO时序约束和时序例外约束才能实现PCB板级的时序收敛.因此,FPGA时序约束中IO口时序约束也是一个重点.只有约束正确 ...

  10. Frame Stacking ZOJ 1083,poj 1128

    Frame Stacking Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 4034   Accepted: 1352 De ...