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> ...
随机推荐
- 线程池构造类 ThreadPoolExecutor 的 5 个参数
1.corePoolSize :核心线程数 2.maxPoolSize: 最大线程数 3.keepAliveTime :闲置线程存活时间 4.unit:参数keepAliveTime的时间单位,有7种 ...
- centos 卸载mysql
1 删除Mysql yum remove mysql mysql-server mysql-libs mysql-server; find / -name mysql 将找到的相关东西delete掉 ...
- C++复习:多态
多态 问题引出(赋值兼容性原则遇上函数重写) 面向对象新需求 C++提供的多态解决方案 多态案例 多态工程意义 面向对象三大概念.三种境界(封装.继承. ...
- Win2012&Win2008双系统启动菜单设置
电脑最初安装的是XP,后来想升级操作系统,但XP里又有很多常用软件不想重装,于是装了一个Win2008 R2的双系统,安装好2008R2后,系统自动产生一个2008R2的启动菜单,可以选择进入2008 ...
- C#中属性和字段的区别
属性和字段的区别 在C#中,我们可以非常自由的.毫无限制的访问公有字段,但在一些场合中,我们可能希望限制只能给字段赋于某个范围的值.或是要求字段只能读或只能写,或是在改变字段时能改变对象的其他一些状态 ...
- python 稀疏向量和矩阵的表示形式
http://blog.csdn.net/nkwangjie/article/details/17502443 http://blog.csdn.net/bitcarmanlee/article/de ...
- 最小生成树二·Kruscal算法
描述 随着小Hi拥有城市数目的增加,在之间所使用的Prim算法已经无法继续使用了——但是幸运的是,经过计算机的分析,小Hi已经筛选出了一些比较适合建造道路的路线,这个数量并没有特别的大. 所以问题变成 ...
- 判断素数(翁凯男神MOOC)
从2到x-1测试是否可以整除 int isPrime(int x); int main(int argc, char **argv) { int x; scanf("%d",&am ...
- Windows 10 显示中的仅更改文本大小和加粗选项
问题描述: 在Windows 10 1703 之前的版本,在控制面板-显示中,存在如下图中的图形界面设置: 系统升级到Windows 10 1703 或是Windows 10 1709 之后,不再存在 ...
- 启动 idea 编译报错 kotlin
怀疑是插件问题. 重新删除了. C:\Users\user 里面inteliJIdea2018.3 缓存 ,解决