Codeforces Beta Round #76 (Div. 2 Only)
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)的更多相关文章
- Codeforces Beta Round #80 (Div. 2 Only)【ABCD】
Codeforces Beta Round #80 (Div. 2 Only) A Blackjack1 题意 一共52张扑克,A代表1或者11,2-10表示自己的数字,其他都表示10 现在你已经有一 ...
- Codeforces Beta Round #83 (Div. 1 Only)题解【ABCD】
Codeforces Beta Round #83 (Div. 1 Only) A. Dorm Water Supply 题意 给你一个n点m边的图,保证每个点的入度和出度最多为1 如果这个点入度为0 ...
- Codeforces Beta Round #79 (Div. 2 Only)
Codeforces Beta Round #79 (Div. 2 Only) http://codeforces.com/contest/102 A #include<bits/stdc++. ...
- Codeforces Beta Round #77 (Div. 2 Only)
Codeforces Beta Round #77 (Div. 2 Only) http://codeforces.com/contest/96 A #include<bits/stdc++.h ...
- Codeforces Beta Round #75 (Div. 2 Only)
Codeforces Beta Round #75 (Div. 2 Only) http://codeforces.com/contest/92 A #include<iostream> ...
- Codeforces Beta Round #74 (Div. 2 Only)
Codeforces Beta Round #74 (Div. 2 Only) http://codeforces.com/contest/90 A #include<iostream> ...
- Codeforces Beta Round #73 (Div. 2 Only)
Codeforces Beta Round #73 (Div. 2 Only) http://codeforces.com/contest/88 A 模拟 #include<bits/stdc+ ...
- Codeforces Beta Round #72 (Div. 2 Only)
Codeforces Beta Round #72 (Div. 2 Only) http://codeforces.com/contest/84 A #include<bits/stdc++.h ...
- Codeforces Beta Round #70 (Div. 2)
Codeforces Beta Round #70 (Div. 2) http://codeforces.com/contest/78 A #include<bits/stdc++.h> ...
随机推荐
- beego orm操蛋问题:操作都需要主键
查看bee generate appcode自动生成的代码,会发现orm操作都是以主键为依据的. 如果我不想根据主键怎么操作?用 ORM.Raw(cmd).Exec()吧,cmd=[你的mysql语句 ...
- delphi java 日期 转换 获取Unix时间戳
获取Unix时间戳 http://www.cnblogs.com/findumars/p/4716753.html 最简单准确一句话 Result:=IntToStr( DateTimeToUnix ...
- Office2019都有哪些强大功能
前阵子是微软一年一度的Ignite大会.而其中最引人注目.也是与我们一般人最息息相关的消息,当然是Office 2019的正式发布. 尽管Office 2019所更新的功能,对于Office 365的 ...
- 轻量级Java持久化框架,Hibernate完美助手,Minidao 1.6.2版本发布
Minidao 1.6.2 版本发布,轻量级Java持久化框架(Hibernate完美助手) Minidao产生初衷? 采用Hibernate的J2EE项目都有一个痛病,针对复杂业务SQL,hiber ...
- Java 判断当前系统为Window或者Linux
public static boolean isOSLinux() { Properties prop = System.getProperties(); String ...
- Linux kafka 单机安装
Kafka地址(选择最新地址1.1.1) http://archive.apache.org/dist/kafka/
- ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql/mysql.sock' (2)
[root@XXX ~]# mysql -h localhost -uroot -p Enter password: ERROR (HY000): Can't connect to local MyS ...
- jquery-menu-aim插件实现二级导航
jquery-menu-aim插件是实现二级导航亚马逊式三角滑动的强力工具,它在性能上极佳,快速滑动,基本无延迟效果,源码位置见对应作者的github,接下来附上样例代码: $(function () ...
- 07_组件三大属性(1)_state
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- dependencies与dependencyManagement的区别
1.DepencyManagement应用场景 当我们的项目模块很多的时候,我们使用Maven管理项目非常方便,帮助我们管理构建.文档.报告.依赖.scms.发布.分发的方法.可以方便的编译代码.进行 ...