Codeforces Beta Round #76 (Div. 2 Only)

时间:2022-09-05 11:59:36

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 &num;80 &lpar;Div&period; 2 Only&rpar;【ABCD】

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

  2. Codeforces Beta Round &num;83 &lpar;Div&period; 1 Only&rpar;题解【ABCD】

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

  3. Codeforces Beta Round &num;79 &lpar;Div&period; 2 Only&rpar;

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

  4. Codeforces Beta Round &num;77 &lpar;Div&period; 2 Only&rpar;

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

  5. Codeforces Beta Round &num;75 &lpar;Div&period; 2 Only&rpar;

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

  6. Codeforces Beta Round &num;74 &lpar;Div&period; 2 Only&rpar;

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

  7. Codeforces Beta Round &num;73 &lpar;Div&period; 2 Only&rpar;

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

  8. Codeforces Beta Round &num;72 &lpar;Div&period; 2 Only&rpar;

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

  9. Codeforces Beta Round &num;70 &lpar;Div&period; 2&rpar;

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

随机推荐

  1. Scrapy shell调试网页的信息

    通过scrapy shell "http://www.thinkive.cn:10000/zentaopms/www/index.php?m=user&f=login"

  2. CBOW Model Formula Deduction

    Paper Reference: word2vec Parameter Learning Explained 1. One-word context Model In our setting, the ...

  3. Spring&period;Net Remoting 相关使用

    http://www.cnblogs.com/GoodHelper/archive/2009/11/19/SpringNet_Remoting.html  本博客系统转载  原文为 Spring.Se ...

  4. PAM禁止root用户登录,限制普通用户使用su切换到root

    系统环境是CentOS 6.5, 介绍下PAM(Pluggable Authentication Modules)在ssh服务上的简单配置过程. 1.必须先添加普通用户,并属于wheel组:保证有除r ...

  5. BITED-Windows8应用开发学习札记之四:如何在Win8 应用中实现语义缩放

    语意缩放的意义在于:创新的语意缩放外观,让你的应用随时展现信息可视化的力量.如图表般的Tile,随着数据的不同而变化,让你的页面更富节奏.而所谓的语意缩放就是通过上下文的跳转,帮助我们实现一种更快更便 ...

  6. mac 目录详解

    打开Macintosh HD你会发现内中有四个文件夹 分别有——应用程序(Applications).系统(System).用户(User).资料库(Library).四个文件夹中又分别各有若干数量的 ...

  7. 通常我们使用&lbrack;NSDate date&rsqb;方法得到的时间与当前时间不一致,如何解决?

    NSDate *date = [NSDate date];    NSTimeZone *zone = [NSTimeZone systemTimeZone];    NSInteger interv ...

  8. &amp&semi;lt&semi;ASP&period;NET4 从入门到精通&amp&semi;gt&semi;学习笔记1

    非常久没有写东西了,今日有时间,開始整理一下关于ASP.NET 4的学习笔记.提醒自己,也欢迎评论. 概述一共分为6个大的部分,兴许文章.将依据每一个部分进行整理,本读书笔记仅仅是整理关键点,对于啰嗦 ...

  9. enum(枚举类型)

    可以使用枚举类型声明代表整数常量的符号名称. 通过enum,创建一个新类型,并指定它可以拥有的值.(就像平常用一个整形变量,我们指定它等于0的时候代表什么,1呢,2呢...而通过枚举,就增加了程序的可 ...

  10. 女朋友也能看懂的Zookeeper分布式锁原理

      前言 关于分布式锁,在互联网行业的使用场景还是比较多的,比如电商的库存扣减,秒杀活动,集群定时任务执行等需要进程互斥的场景.而实现分布式锁的手段也很多,大家比较常见的就是redis跟zookeep ...