Codeforces Beta Round #76 (Div. 2 Only)

http://codeforces.com/contest/94

A

 #include<bits/stdc++.h>
using namespace std;
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define sqr(x) ((x)*(x))
#define pb push_back
#define eb emplace_back
#define maxn 200005
#define eps 1e-8
#define pi acos(-1.0)
#define rep(k,i,j) for(int k=i;k<j;k++)
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<char,int> pci;
typedef pair<pair<int,string>,pii> ppp;
typedef unsigned long long ull;
const long long MOD=1e9+;
/*#ifndef ONLINE_JUDGE
freopen("1.txt","r",stdin);
#endif */ string s[];
string s1[]; int main(){
#ifndef ONLINE_JUDGE
// freopen("1.txt","r",stdin);
#endif
std::ios::sync_with_stdio(false);
string str;
cin>>str;
for(int i=;i<;i++){
cin>>s[i];
}
for(int i=;i<;i++){
for(int j=;j<;j++){
s1[i]+=str[i*+j];
}
}
for(int i=;i<;i++){
for(int j=;j<;j++){
if(s1[i]==s[j]){
cout<<j;
break;
}
}
}
}

B

 #include<bits/stdc++.h>
using namespace std;
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define sqr(x) ((x)*(x))
#define pb push_back
#define eb emplace_back
#define maxn 200005
#define eps 1e-8
#define pi acos(-1.0)
#define rep(k,i,j) for(int k=i;k<j;k++)
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<char,int> pci;
typedef pair<pair<int,string>,pii> ppp;
typedef unsigned long long ull;
const long long MOD=1e9+;
/*#ifndef ONLINE_JUDGE
freopen("1.txt","r",stdin);
#endif */ int d[]; int main(){
#ifndef ONLINE_JUDGE
// freopen("1.txt","r",stdin);
#endif
std::ios::sync_with_stdio(false);
string str;
int n;
cin>>n;
int u,v;
for(int i=;i<=n;i++){
cin>>u>>v;
d[u]++;
d[v]++;
}
for(int i=;i<=;i++){
if(d[i]!=){
cout<<"WIN"<<endl;
return ;
}
}
cout<<"FAIL"<<endl;
}

C

找规律

 #include<bits/stdc++.h>
using namespace std;
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define sqr(x) ((x)*(x))
#define pb push_back
#define eb emplace_back
#define maxn 200005
#define eps 1e-8
#define pi acos(-1.0)
#define rep(k,i,j) for(int k=i;k<j;k++)
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<char,int> pci;
typedef pair<pair<int,string>,pii> ppp;
typedef unsigned long long ull;
const long long MOD=1e9+;
/*#ifndef ONLINE_JUDGE
freopen("1.txt","r",stdin);
#endif */ int main(){
#ifndef ONLINE_JUDGE
// freopen("1.txt","r",stdin);
#endif
std::ios::sync_with_stdio(false);
long long n,m,a,b;
cin>>n>>m>>a>>b;
int s,t;
s=a/m+(a%m!=);
t=b/m+(b%m!=);
if(m==){
cout<<;
return ;
}
if(b==n){
if(a%m==||s==t) cout<<;
else cout<<;
return ;
}
if((a%m==&&b%m==)||s==t) {cout<<;return ;}
if(a%m==||b%m==||s+==t||(b+)%m==a%m) cout<<;
else cout<<; }

D

贪心

 #include<bits/stdc++.h>
using namespace std;
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define sqr(x) ((x)*(x))
#define pb push_back
#define eb emplace_back
#define maxn 200005
#define eps 1e-8
#define pi acos(-1.0)
#define rep(k,i,j) for(int k=i;k<j;k++)
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<char,int> pci;
typedef pair<pair<int,string>,pii> ppp;
typedef unsigned long long ull;
const long long MOD=1e9+;
/*#ifndef ONLINE_JUDGE
freopen("1.txt","r",stdin);
#endif */ int cnt[];
int g[][]; int main(){
#ifndef ONLINE_JUDGE
// freopen("1.txt","r",stdin);
#endif
// std::ios::sync_with_stdio(false);
int n,w,m,i,j;
cin>>n>>w>>m;
for(i=;i<n;i++)cnt[i]=m;
int ii=;
for(i=;i<m;i++){
int k=n;
while(k>){
if(cnt[ii]==)
ii++;
cnt[ii]--;
k--;
g[ii][i]++;
}
}
for(i=;i<n;i++){
int cc=;
for(j=;j<m;j++)
if(g[i][j])
cc++;
if(cc>=)
break;
}
if(i<n)
cout<<"NO"<<endl;
else{
cout<<"YES"<<endl;
for(i=;i<m;i++){
bool f=;
for(j=;j<n;j++)
if(g[j][i]){
if(f)
f=;
else
cout<<" ";
printf("%d %.8lf",j+,(g[j][i]*(double)w)/m);
}
cout<<endl;
}
} }

E

暴力搜索

 #include<bits/stdc++.h>
using namespace std;
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define sqr(x) ((x)*(x))
#define pb push_back
#define eb emplace_back
#define maxn 200005
#define eps 1e-8
#define pi acos(-1.0)
#define rep(k,i,j) for(int k=i;k<j;k++)
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<char,int> pci;
typedef pair<pair<int,string>,pii> ppp;
typedef unsigned long long ull;
const long long MOD=1e9+;
/*#ifndef ONLINE_JUDGE
freopen("1.txt","r",stdin);
#endif */ int target;
int best = ;
int op1[], op2[], op3[], bop1[], bop2[], bop3[];
int reg[];
int N; void dfs(int lv){
if (lv>=best)return;
int i,j,k;
for(i=;i<N;i++) if (lv<best && reg[i]==target) {
best=lv;
for(j=;j<lv;j++) {
bop1[j]=op1[j], bop2[j]=op2[j], bop3[j]=op3[j];
}
return;
}
if (lv>=best-) return;
for(i=;i<N;i++) for(j=;j<N;j++) for (k=;k<=;k*=){
if (reg[i] + k*reg[j] > target) continue;
reg[N++] = reg[i] + k*reg[j];
op1[lv]=i; op2[lv]=k; op3[lv]=j;
dfs(lv+);
N--;
}
} int main(){
#ifndef ONLINE_JUDGE
// freopen("1.txt","r",stdin);
#endif
std::ios::sync_with_stdio(false);
cin>>target;
reg[]=, reg[]=; N=;
dfs();
cout<<best<<endl;
int i;
for(i=;i<best;i++) {
cout<<"lea e" << (char)('a'++i)<<"x, [e" << (char)('a'+bop1[i])<<"x + " << bop2[i]<<"*e" << (char)('a'+bop3[i]) << "x]" << endl;
} }

Codeforces Beta Round #76 (Div. 2 Only)的更多相关文章

  1. Codeforces Beta Round #80 (Div. 2 Only)【ABCD】

    Codeforces Beta Round #80 (Div. 2 Only) A Blackjack1 题意 一共52张扑克,A代表1或者11,2-10表示自己的数字,其他都表示10 现在你已经有一 ...

  2. Codeforces Beta Round #83 (Div. 1 Only)题解【ABCD】

    Codeforces Beta Round #83 (Div. 1 Only) A. Dorm Water Supply 题意 给你一个n点m边的图,保证每个点的入度和出度最多为1 如果这个点入度为0 ...

  3. Codeforces Beta Round #79 (Div. 2 Only)

    Codeforces Beta Round #79 (Div. 2 Only) http://codeforces.com/contest/102 A #include<bits/stdc++. ...

  4. Codeforces Beta Round #77 (Div. 2 Only)

    Codeforces Beta Round #77 (Div. 2 Only) http://codeforces.com/contest/96 A #include<bits/stdc++.h ...

  5. Codeforces Beta Round #75 (Div. 2 Only)

    Codeforces Beta Round #75 (Div. 2 Only) http://codeforces.com/contest/92 A #include<iostream> ...

  6. Codeforces Beta Round #74 (Div. 2 Only)

    Codeforces Beta Round #74 (Div. 2 Only) http://codeforces.com/contest/90 A #include<iostream> ...

  7. Codeforces Beta Round #73 (Div. 2 Only)

    Codeforces Beta Round #73 (Div. 2 Only) http://codeforces.com/contest/88 A 模拟 #include<bits/stdc+ ...

  8. Codeforces Beta Round #72 (Div. 2 Only)

    Codeforces Beta Round #72 (Div. 2 Only) http://codeforces.com/contest/84 A #include<bits/stdc++.h ...

  9. Codeforces Beta Round #70 (Div. 2)

    Codeforces Beta Round #70 (Div. 2) http://codeforces.com/contest/78 A #include<bits/stdc++.h> ...

随机推荐

  1. office2016系列产品关闭时卡顿

    关闭Print Spooler服务其方法如下: win+r键–>输入services.msc点击确定如下图 单击word中的文件-选项-加载项-COM加载项-转到,将所有加载项前面的勾都去掉(不 ...

  2. 机器学习进阶-图像基本操作-数值计算 1.cv2.add(将图片进行加和) 2.cv2.resize(图片的维度变换) 3.cv2.addWeighted(将图片按照公式进行重叠操作)

    1.cv2.add(dog_img, cat_img)  # 进行图片的加和 参数说明: cv2.add将两个图片进行加和,大于255的使用255计数 2.cv2.resize(img, (500, ...

  3. MySQL数据库备份工具mysqldump的使用(转)

    说明:MySQL中InnoDB和MyISAM类型数据库,这个工具最新版本好像都已经支持了,以前可能存在于MyISAM的只能只用冷备份方式的说法. 备份指定库: mysqldump -h127.0.0. ...

  4. 使用docker-compose创建启动容器时候提示服务名已存在

    今天在测试环境启动一个已有服务时候提示服务名已存在,造成这个原因是,前些天集群的一个节点挂了,导致这个节点上的docker容器全部没了,为了当时能正常使用就使用 docker-compose -H 1 ...

  5. [PHP]PHP缓存机制之Output Control

    ---------------------------------------------------------------------------------------------------- ...

  6. [PC]PHPCMS配置文件的读取

    --------------------------------------------------------------------------------------------------- ...

  7. python pip 下载慢 配置使用国内源配置

    ubuntu apt 使用国内源 设置>软件和更新>下载自 选择mirrors.aliyun.com/ubuntu 更新源sudo apt-get update 安装系统包:sudo ap ...

  8. Uni2D 入门 -- Animation Clip 和 Animation API

    转载 csdn kakashi8841 http://blog.csdn.net/kakashi8841/article/details/17599505 Animation Clip 一个anima ...

  9. H5做的商城客户端,效果很不错

    H5做的商城客户端,效果很不错 H5做的商城客户端,效果和android原生客户端没多大区别,现在h5是越来越火了, android的小伙伴们又遇到一个新的挑战了.本项目只能学习一下WebViewAc ...

  10. tabel 选中行变色和取当前选中行值等问题

    先把代码贴出来 $("#tableId tbody tr").mousedown(function () {        $('#tableId  tr').each(funct ...