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 ...
随机推荐
- WeakReference与SoftReference
WeakReference与SoftReference都可以用来保存对象的实例引用,这两个类与垃圾回收有关. WeakReference是弱引用,其中保存的对象实例可以被GC回收掉.这个类通常用于在某 ...
- UI5-学习篇-16-云端SCP-Destination配置
1.登录路径: https://account.ap1.hana.ondemand.com/#/home/welcome 2.查看云连接器 如下图所示,虚拟主机都已连接且资源可用: 若虚拟主机连接存在 ...
- js函数的创建
1.js 函数的创建有几种方式: 1.1 直接声明 1.2 创建匿名函数,然后赋值 1.3 声明函数,然后赋值给变量 1.4 使用1.3 得到的变量再赋值给变量 1.5 使用函数对象创建函数 < ...
- join和子查询的一点点思考
代码和表设计过程中,为了考虑数据库的范式,通常导致需要join多张表或子查询, 如报表场景, 可此种方式在大数据量的 情况下,效率较低. 如果能做适量的数据冗余,便可以减少join或子查询,效率较高 ...
- oracle第三天笔记
DDL语句管理表 /* Oracle体系结构: 数据库 ---> 数据库实例ORCL ---> 表空间 (用户里面的创建表) ---> 数据文件 地球 ---> 中国 ---& ...
- jenkins+docker+docker-compose完整发版流程
首先搭建jenkins+maven+nexus这一套自动化打包工具,并配置好相应配置,这里就不再赘述了. 其次,搭建好docker集群和私有仓库,以及安装好docker-compose工具,配置好相应 ...
- 【388】※ Some useful websites for learning Python
Ref: Python Tips 1. *args and **kwargs 2. Debugging 3. Generators 4. Map, Filter and Reduce 5. set D ...
- SQL 语句 写法
SELECT * FROM article where userid=4 order by sort asc LIMIT 0,10; 先根据写where 条件,再排序,在LIMIT.
- LINUX系统一一CentOS6.5之固化Ip
1.查看ip 2.找到网关文件夹 3.编辑ip
- 手机移动端web前端常见问题整理
移动端常见问题及解决方案 一.meta基础知识 H5页面窗口自动调整到设备宽度,并禁止用户缩放页面 <meta name="viewport" content="w ...