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. 机器学习入门-数值特征-连续数据离散化(进行分段标记处理) 1.hist(Dataframe格式直接画直方图)

    函数说明: 1. .hist 对于Dataframe格式的数据,我们可以使用.hist直接画出直方图 对于一些像年龄和工资一样的连续数据,我们可以对其进行分段标记处理,使得这些连续的数据变成离散化 就 ...

  2. day20-面向对象编程、继承

    一.面向对象编程 1.简介 面向对象编程——Object Oriented Programming,简称OOP,是一种程序设计思想.OOP把对象作为程序的基本单元,一个对象包含了数据和操作数据的函数. ...

  3. elasticsearch-ik

    因lucene默认采用英文且英文通过空格就可以断句.而中文则是词组,如果不加载中文词库或插件则会变为一个一个字而非词组,因此需要加载中文词库. 不加分词库所看到的中文分词效果. post _analy ...

  4. 爬虫--Scrapy框架课程介绍

    Scrapy框架课程介绍: 框架的简介和基础使用 持久化存储 代理和cookie 日志等级和请求传参 CrawlSpider 基于redis的分布式爬虫 一scrapy框架的简介和基础使用 a)    ...

  5. C# 简单的定时关机

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...

  6. 注解(Annotation)是什么?

  7. SQL Server 用角色(Role)管理数据库权限

    当数据库越来越多,连接到数据库的应用程序,服务器,账号越来越多的时候,为了既能达到满足账号操作数据权限需求,又不扩大其操作权限,保证数据库的安全性,有时候需要用角色来参与到权限管理中,通过角色做一个权 ...

  8. mysql 存储过程小问题

    mysql写的存储过程的一些小问题 DELIMITER $$ USE `yzhoteldb`$$ DROP PROCEDURE IF EXISTS `yz_waveData`$$ CREATE DEF ...

  9. Docker虚拟化平台

    1.虚拟化技术的概念 1)虚拟化就是把物理资源转变为逻辑上可以管理的资源,以打破物理结构间的壁垒,让计算机的元件运行在虚拟的基础上,而不是真实的物理设备: 2)虚拟化技术可以将物理机硬件资源虚拟生成单 ...

  10. MongoDB常用查询,排序,group,SpringDataMongoDB update group

    MongoDB查询 指定查询并排序 db.getCollection('location').find({"site.id":"川A12345","s ...