#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. 大浪淘沙,JSP终将死去

    首先讲明,我不是标题党. 这纯属我个人的意见.勿喷. 先来讲讲JSP是怎么出现的吧. 在早期的WEB中,JS.CSS远未成熟,技术慷慨向并不明白!因为前端语言的匮乏.各家大公司都推出基于后端的模板语言 ...

  2. A. Ilya and Diplomas( Codeforces Round #311 (Div. 2) )

    A. Ilya and Diplomas time limit per test 1 second memory limit per test 256 megabytes input standard ...

  3. CMD应用 qtp/winshell/cmd的交互

    =================================================================== '採用windows.shell的 sendkeys 方式: s ...

  4. gcc 源代码下载地址

    ftp://mirrors-usa.go-parts.com/gcc/releases/

  5. Android JNI和NDK学习(09)--JNI实例二 传递类对象

    1 应用层代码 NdkParam.java是JNI函数的调用类,它的代码如下:   package com.skywang.ndk; import android.app.Activity; impo ...

  6. neat算法——本质就是遗传算法用于神经网络的自动构建

    基于NEAT算法的马里奥AI实现 所谓NEAT算法即通过增强拓扑的进化神经网络(Evolving Neural Networks through Augmenting Topologies),算法不同 ...

  7. 使用caffemodel模型(由mnist训练)测试单张手写数字样本

    caffe中训练和测试mnist数据集都是批处理,可以反馈识别率,但是看不到单张样本的识别效果,这里使用windows自带的画图工具手写制作0~9的测试数字,然后使用caffemodel模型识别. 1 ...

  8. vuejs fatherandson

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  9. vue打包后js和css、图片不显示,引用的字体找不到问题

    vue打包后js和css.图片不显示,引用的字体找不到问题:图片一般都是背景图片. 一.vue打包出现js和css不显示问题: 1.不使用mode:'history' 2.使用mode:'histor ...

  10. 安装Debugging Tools时出现错误Setup could not find the file WinSDK_amd64的处理

    安装Debugging Tools时出现错误Setup could not find the file WinSDK_amd64的处理 1.软件来源:  微软官网下载SDK ISO安装包(含有debu ...