Codeforces Beta Round #73 (Div. 2 Only)
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)的更多相关文章
- 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 #76 (Div. 2 Only)
		Codeforces Beta Round #76 (Div. 2 Only) http://codeforces.com/contest/94 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 #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> ... 
随机推荐
- MySQL创建只读账号
			应用场景:只要公司有数据团队的,那免不了让这帮家伙把全公司的数据库数据都摸一遍,但是要是直接把root用户给了他们,未免有点危险,于是只能给这帮人设权限,一般而言,他们只是做读操作,既然做读操作,那么 ... 
- ABAP-数据引用
			*&---------------------------------------------------------------------* *& Report ZRICO_TES ... 
- EventBus 源码学习
			打开一看,原来相关代码并不多,下面看下细节 主要方法也就是注册,取消注册和发送事件,可以看到两个主要的变量就是subscribers和dispatcher public void register(O ... 
- jquery接触初级-----ajax 之:load()方法
			jquery _ajax 请求主要有几种方式:load(),$.get(),$.post(),$.ajax(),$.getScript(),$.getJson() 1.load()方法 格式:load ... 
- 尚硅谷redis学习11-jedis操作redis
			前面学习了redis的知识后,下面学习一下如何在java中通过jedis操作redis. 所需jar包:commons-pool-xxxx.jar,jedis-xxx.jar 下面看一下常用操作: 1 ... 
- decode 函数用法
			含义解释: decode(条件,值1,返回值1,值2,返回值2,...值n,返回值n,缺省值) 该函数的含义如下:IF 条件=值1 THEN RETURN(翻译值1)ELSIF 条件=值2 THEN ... 
- How to Pronounce T + Dark L
			How to Pronounce T + Dark L Share Tweet Share Tagged With: Dark L The T and Dark L combination is co ... 
- LeetCode OJ 47. Permutations II
			题目 Given a collection of numbers that might contain duplicates, return all possible unique permutati ... 
- kubectl windows
			https://storage.googleapis.com/kubernetes-release/release/v1.10.3/bin/windows/amd64/kubectl.exe 
- 2018面向对象程序设计(Java)第9周学习指导及要求
			2018面向对象程序设计(Java)第9周学习指导及要求(2018.10.25-2018.10.28) 学习目标 1.掌握java异常处理技术: 2.了解断言的用法: 3.了解日志的用途: 4.掌 ... 
