Codeforces Beta Round #44 (Div. 2)
Codeforces Beta Round #44 (Div. 2)
http://codeforces.com/contest/47
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 maxn 1000005
typedef long long ll;
typedef unsigned long long ull; int main(){
#ifndef ONLINE_JUDGE
// freopen("input.txt","r",stdin);
#endif
std::ios::sync_with_stdio(false);
map<int,int>mp;
for(int i=;i<=;i++){
mp[i*(i+)/]=;
}
int n;
cin>>n;
if(mp[n]) cout<<"YES"<<endl;
else cout<<"NO"<<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 maxn 1000005
typedef long long ll;
typedef unsigned long long ull; struct sair{
char ch;
int v;
bool operator<(const sair &b)const{
return v>b.v;
}
}s; int main(){
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
#endif
std::ios::sync_with_stdio(false);
int a,b,c;
string str;
map<char,int>mp;
mp['A']++;
mp['B']++;
mp['C']++;
for(int i=;i<=;i++){
cin>>str;
if(str[]=='>'){
mp[str[]]++;
}
else{
mp[str[]]++;
}
}
vector<sair>ve;
int book[];
memset(book,,sizeof(book));
for(map<char,int>::iterator it=mp.begin();it!=mp.end();it++){
s.ch=it->first;
s.v=it->second;
if(book[s.v]){
cout<<"Impossible"<<endl;
return ;
}
book[s.v]=;
ve.push_back(s);
}
sort(ve.begin(),ve.end());
for(int i=;i<ve.size();i++){
cout<<ve[i].ch;
} }
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 maxn 1000005
typedef long long ll;
typedef unsigned long long ull; vector<string>ans;
string s[];
bool add(char &a,char b){if (a!='.'&&a!=b)return ;a=b;return ;} int main(){
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
#endif
std::ios::sync_with_stdio(false);
for (int i=;i<=;i++)cin>>s[i];
sort(s,s+);
do{
vector<string>v(s[].size(),string(s[].size(),'.'));
if (s[].size()!=s[].size()+s[].size()-) continue;
if (s[].size()!=s[].size()+s[].size()-) continue;
bool fl=;
for (int i=;i<s[].size();i++)fl&=add(v[i][s[].size()-],s[][i]);
for (int i=;i<s[].size();i++)fl&=add(v[s[].size()-][i],s[][i]);
for (int i=;i<s[].size();i++)fl&=add(v[][i],s[][i]);
for (int i=;i<s[].size();i++)fl&=add(v[i][],s[][i]);
for (int i=;i<s[].size();i++)fl&=add(v[s[].size()-+i][s[].size()-],s[][i]);
for (int i=;i<s[].size();i++)fl&=add(v[s[].size()-][s[].size()-+i],s[][i]);
if (!fl) continue;
if (ans.empty()||v<ans) ans=v;
}while (next_permutation(s,s+));
if (ans.empty()) cout<<"Impossible"<<endl;
else for(auto i:ans) cout<<i<<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 maxn 1000005
typedef long long ll;
typedef unsigned long long ull; char s[][];
int c[],n,m,ans;
void dfs(int t)
{
int i,j;
for(i=;i<m;i++)
if(c[i]<)return ;
if(t>=n)
{
for(i=;i<m;i++)
if(c[i]>) return ;
ans++;
return ;
}
for(i=;i<=;i++)
{
for(j=;j<m;j++)
if(s[j][t]==(i+''))c[j]--;
dfs(t+);
for(j=;j<m;j++)
if(s[j][t]==(i+''))c[j]++;
}
} int main(){
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
#endif
std::ios::sync_with_stdio(false);
cin>>n>>m;
for(int i=;i<m;i++)cin>>s[i]>>c[i];
ans=;
dfs();
cout<<ans<<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 maxn 1000005
typedef long long ll;
typedef unsigned long long ull; const double g=9.8;
double v,al[],ss[],cc[];
int d[];
pair<double,double> w[];
double x[]; double run(double x,double alpha)
{
return (v*sin(alpha)+v*sin(alpha)-g*x/(v*cos(alpha)))*x/(v*cos(alpha))/;
}
bool cmp(const int &a,const int &b)
{
return al[a]<al[b];
} int main(){
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
#endif
std::ios::sync_with_stdio(false);
int n,m;
scanf("%d%lf",&n,&v);
for(int i=;i<=n;i++)
scanf("%lf",&al[d[i]=i]),cc[i]=cos(al[i]),ss[i]=sin(al[i]);
sort(d+,d++n,cmp);
scanf("%d",&m);
for(int i=;i<=m;i++)
scanf("%lf%lf",&w[i].first,&w[i].second);
sort(w+,w++m);
int j=;
for(int i=;i<=n;i++)
{
while(j<=m&&run(w[j].first,al[d[i]])>w[j].second)j++;
if(j>m||run(w[j].first,al[d[i]])<)
{
x[d[i]]=v*ss[d[i]]/g**v*cc[d[i]];
continue;
}
x[d[i]]=w[j].first;
}
for(int i=;i<=n;i++)
printf("%.9lf %.9lf\n",x[i],run(x[i],al[i]));
}
Codeforces Beta Round #44 (Div. 2)的更多相关文章
- 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 #73 (Div. 2 Only)
Codeforces Beta Round #73 (Div. 2 Only) http://codeforces.com/contest/88 A 模拟 #include<bits/stdc+ ...
- Codeforces Beta Round #72 (Div. 2 Only)
Codeforces Beta Round #72 (Div. 2 Only) http://codeforces.com/contest/84 A #include<bits/stdc++.h ...
随机推荐
- Spring Cloud (6)config 客户端配置 与GitHub通信
1. 配置yml 1.1 1.2 1.3 2. 提交yml 到git 3.新建项目 pom 4.新建bootstrap.yml (优先权比application.yml高) 5.bootstrap.y ...
- Linux的学习 --corntab
计划任务的使用方法 http://www.cnblogs.com/CraryPrimitiveMan/p/4124851.html
- 快速掌握和使用Flyway
什么是Flyway? 转载:https://blog.waterstrong.me/flyway-in-practice/ Flyway is an open-source database migr ...
- day04-运算符
Python语言支持以下类型的运算符: 算术运算符比较运算符赋值运算符逻辑运算符位运算符成员运算符身份运算符 算术运算符 运算符 描述 实例 + 加 - 两个对象相加 10+20输出结果 30 - 减 ...
- jq时间戳动画
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- MethodInfo类的一般使用
1.MethodInfo类是在System.Reflection命名空间底下,既然是在Reflection空间底下.故名思议关于反射相关的操作,其中比较重要的方法是Invoke()方法,它 是加载相同 ...
- jQuery 知识体系
jQuery基础知识一 jQuery之知识二-选择器 [jQuery知识]jQuery之知识三-过滤器 [jQuery知识]jQuery之知识四-DOM和CSS操作 [jQuery知识]jQuery之 ...
- How ASP.NET MVC Works ? (Artech)
一.ASP.NET + MVC IIS与ASP.NET管道 MVC.MVP以及Model2[上篇] MVC.MVP以及Model2[下篇] ASP.NET MVC是如何运行的[1]: 建立在“伪”MV ...
- [jPlayer]一分钟部署jPlayer
---------------------------------------------------------------------------------------------------- ...
- CSS3性能体验
如今许多新技术名词在不断的被提及中,已然向我们靠近.某篮球运动员说了:“变向过人”不是超级明星的专利,也许我也可以试着去做,现在看起来效果还不错...那么,现在我们来体验CSS3:CSS3中的动画功能 ...