Codeforces Beta Round #73 (Div. 2 Only)

http://codeforces.com/contest/88

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 1000006
#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<pair<int,string>,pii> ppp;
typedef unsigned long long ull; string s[]={"C","C#","D","D#","E","F","F#","G","G#","A","B","H"},a,b,c;
int x[]; int main(){
#ifndef ONLINE_JUDGE
// freopen("input.txt","r",stdin);
#endif
std::ios::sync_with_stdio(false);
cin >> a >> b >> c;
for(int i=;i<;i++){
if(a==s[i] || b==s[i] || c==s[i])x[i]=;
}
for(int i=;i<;i++){
if(x[i]){
if(x[(i+)%] && x[(i+)%]){
cout << "major" << endl;
return ;
}
if(x[(i+)%] && x[(i+)%]){
cout << "minor" << endl;
return ;
}
}
}
cout << "strange" << endl;
}

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 1000006
#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<pair<int,string>,pii> ppp;
typedef unsigned long long ull; string str;
map<char,int>mp;
string s[];
map<char,int>book;
vector<pii>ve; double dis(int a,int b,int c,int d){
return sqrt(sqr(a-c)+sqr(b-d));
} int main(){
#ifndef ONLINE_JUDGE
// freopen("input.txt","r",stdin);
#endif
std::ios::sync_with_stdio(false);
int n,m,len;
double x;
cin>>n>>m>>x;
for(int i=;i<n;i++){
cin>>s[i];
for(int j=;j<m;j++){
mp[s[i][j]]=;
if(s[i][j]=='S') ve.pb(make_pair(i,j));
}
}
cin>>len>>str;
int ans=;
pii tmp;
double dist;
for(int k=;k<ve.size();k++){
for(int i=;i<n;i++){
for(int j=;j<m;j++){
dist=dis(ve[k].first,ve[k].second,i,j);
if(dist<=x) {
book[s[i][j]]=;
}
}
}
}
int i;
for(i=;i<len;i++){
if((str[i]>='A'&&str[i]<='Z'&&!mp[str[i]+])||(str[i]>='A'&&str[i]<='Z'&&!mp['S'])||(str[i]>='a'&&str[i]<='z'&&!mp[str[i]])) {
ans=;
break;
}
else if(str[i]>='A'&&str[i]<='Z'&&mp['S']){
if(!book[str[i]+]) ans++;
}
}
if(i==len&&ans==) cout<<<<endl;
else if(!ans) cout<<-<<endl;
else cout<<ans<<endl;
}

C

gcd

 #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 1000006
#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<pair<int,string>,pii> ppp;
typedef unsigned long long ull; int main(){
#ifndef ONLINE_JUDGE
// freopen("input.txt","r",stdin);
#endif
std::ios::sync_with_stdio(false);
int a,b;
cin >> a>>b;
cout <<((abs(a/__gcd(a,b)-b/__gcd(a,b))==)?"Equal":(a<b?"Dasha":"Masha"))<<endl;
}

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 1000006
#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<double,double>pdd;
typedef pair<pair<int,string>,pii> ppp;
typedef unsigned long long ull; map<string,int>mp;
int n,cou;
string a,b,c;
void solve()
{
cin>>b;
int ans=;
string d="";
for(int i=; i<b.size(); i++)
{
if(b[i]=='&') ans--;
else if(b[i]=='*') ans++;
else d+=b[i];
}
cou=mp[d];
if(cou>) cou+=ans;
else cou=;
b.clear();
} int main(){
#ifndef ONLINE_JUDGE
// freopen("input.txt","r",stdin);
#endif
std::ios::sync_with_stdio(false);
mp["void"]=;
cin>>n;
while(n--)
{
cin>>a;
if(a=="typedef")
{
solve();
cin>>c;
mp[c]=cou;
c.clear();
}
else if(a=="typeof")
{
solve();
if(--cou<) cout<<"errtype"<<endl;
else
{
cout<<"void";
for(int i=; i<cou; i++) cout<<"*";
cout<<endl;
}
}
a.clear();
}
}

E

sg函数(照着AC代码打的,没有完全理解)

 #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 maxn 100005
typedef long long ll;
typedef unsigned long long ull;
const ull MOD=;
/*#ifndef ONLINE_JUDGE
freopen("1.txt","r",stdin);
#endif */ int ans[maxn],sg[maxn],mex[maxn]; void getsg(int n){ for(int i=;i*(i+)/<=n;i++){
if((*n)%i==){
int t=*n/i-i+;
if((t&)||t<) continue;
t/=;
mex[sg[t-+i]^sg[t-]]=n;
if((sg[t-+i]^sg[t-])==)
if(ans[n]==-)
ans[n]=i;
}
}
sg[n]=-;
for(int i=;;i++){
if(mex[i]!=n){
sg[n]=i;
break;
}
}
sg[n]^=sg[n-];
return ;
} int main(){
#ifndef ONLINE_JUDGE
// freopen("1.txt","r",stdin);
#endif
std::ios::sync_with_stdio(false);
int n;
cin>>n;
memset(ans,-,sizeof(ans));
for(int i=;i<=n;i++){
getsg(i);
}
cout<<ans[n]<<endl;
}

Codeforces Beta Round #73 (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 #76 (Div. 2 Only)

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

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

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

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

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

  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. 完全分布式hadoop2.5.0安装 VMware下虚拟机centos6.4安装1主两从hadoop

    请跟我走,从零开始搭建hadoop2.5.0环境.总览第一步:搭建三台能不用密码shh的虚拟机.第二步,装jdk,解压hadoop文件,配置环境变量和xml文件.第三步,复制克隆两个slave机器.调 ...

  2. C++中多态中构造函数与析构函数的调用

    做个实验,看一下成员变量的构造析构,父类子类的构造析构,以及虚函数对调用的影响. #include <iostream> using namespace std; class Member ...

  3. 机器学习进阶-图像特征sift-SIFT特征点 1.cv2.xfeatures2d.SIFT_create(实例化sift) 2. sift.detect(找出关键点) 3.cv2.drawKeypoints(画出关键点) 4.sift.compute(根据关键点计算sift向量)

    1. sift = cv2.xfeatures2d.SIFT_create() 实例化 参数说明:sift为实例化的sift函数 2. kp = sift.detect(gray, None)  找出 ...

  4. python-玉米(小米)商城作业

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  5. java序列化问题

    今天无意中看到了     redistemplet封装的类中,出现了序列化的字眼 ,了解下序列化的知识 1.什么是序列化 我们把变量从内存中变成可存储或传输的过程称之为序列化,(java中一般是用来保 ...

  6. jvm问题

     问题: 1. 一台服务器,部署多个服务,请问,这多个服务,对应的是一个jvm,还是多个jvm? 2. 一个线程,从controller 到 service,到DAO,会调用多个方法,请问是 对应一个 ...

  7. webpack异步加载业务模块

    虽然把我们用到的JS文件全部打包一个可以节省请求数,但如果打包后的JS文件过大,那么也容易出现白屏现象,许多操作失灵.而且一些区域是点到才出现,那么相关的JS其实可以剥离出这个大JS文件外.这就涉及到 ...

  8. ShaderLab学习总结

    转载 Unity ShaderLab学习总结 Why Bothers? 为什么已经有ShaderForge这种可视化Shader编辑器.为什么Asset Store已经有那么多炫酷的Shader组件可 ...

  9. 在windows上通过ssh远程链接linux服务器[转]

    本文分别转自 [http://jingyan.baidu.com/article/6d704a130de40e28db51cab5.html] [http://www.cnblogs.com/mliu ...

  10. 学JS的心路历程-Promise(二)

    昨天有说到Promise的创建以及then的用法,今天我们来看错误处理. then onRejected 我们昨天有提到说,then两个函式参数,onFulfilled和onRejected,而onR ...