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> ...
随机推荐
- 类方法@classmethod
通常情况下,如果我们要使用一个类的方法,那我们只能将一个类实体化成一个对象,进而调用对象使用方法. 式例 1 比如: class Hello(object): def __init__: ...
- js对象引用和赋值
体验更优排版请移步原文:http://blog.kwin.wang/programming/js-object-reference-assign.html 先看一个简单例子, var obj = { ...
- 深度学习原理与框架-神经网络-线性回归与神经网络的效果对比 1.np.c_[将数据进行合并] 2.np.linspace(将数据拆成n等分) 3.np.meshgrid(将一维数据表示为二维的维度) 4.plt.contourf(画出等高线图,画算法边界)
1. np.c[a, b] 将列表或者数据进行合并,我们也可以使用np.concatenate 参数说明:a和b表示输入的列表数据 2.np.linspace(0, 1, N) # 将0和1之间的数 ...
- day04-完整性约束
完整性约束 关键字: not null 与 default unique primary auto_increment foreign key 1.介绍 约束条件与数据类型的宽度一样,都是可选参数作用 ...
- javascript:解决两个小数相乘出现无限小数
两个小数相乘,会出现无限小数:先把小数乘以10或100或1000(小数点后有多少位就乘以多少),再相乘,最后再除以10或100或1000
- Python爬虫示例
#!/usr/bin/python #coding:utf8 import re import urllib def gethtml(url): page=urllib.urlopen(url) ht ...
- openwrt手动wifi设成client模式[笔记]
说明:刚刷好的OPENWRT,默认是不带luci-web管理的,所以得手工SSH或TELNET上去改WIFI模式,以便通过WIFI连到现有的ROUTER去下载安装luci...: root@OpenW ...
- C# 如何获取鼠标在屏幕上的位置,不论程序是否为活动状态
一开始我认为应该使用HOOK来写,而且必须使用全局HOOK,结果在一次偶然的机会得到,原来其实根本没有那个必要. 直接上代码吧,一看就明白 Point ms = Control.MousePositi ...
- ESET官方下载地址
官方远程下载 ESET NOD32 Antivirus(32位) ESET NOD32 Antivirus(64位) ESET Smart Security(32位) ESET Smart Secur ...
- [译]CQRS介绍
以下内容均为看完原文后自己的理解.并非一字一句翻译,会尽量保持原文意思. 什么是 CQRS: CQRS 意思就是命令查询职责分离(Command Query Responsibility Segreg ...