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 ...
随机推荐
- delphi 控件编辑器
控件编辑器和属性编辑器类似 http://www.rgzz.sdedu.net/ebook/hdbook/computer/bc/delphizhuanti/rmjq/028.htm TCommonD ...
- c# sql等微型代码工具LinqPad
- scala 爬虫 去除不能存储的特殊字符
scala 爬虫 去除不能存储的特殊字符 /** * 去除不能存储的特殊字符 */ def zifuChange(str: String): String = { var bo = true var ...
- ABAP-异常捕获
异常处理 基于类的异常exception classes 捕获 使用老式方式捕获catchable runtime errors 向上抛出异常 手动触发异常(类异常) 6.1版本以后,TRY…ENDT ...
- 08_组件三大属性(2)_props
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...
- netty ChannelOption
项目中用到很多netty,配置了各种不同的ChannelOption优化项,不同的配置对于在高并发情况下的性能有不小的影响 首先看下全部项目,参考下这篇文章,虽然不全 https://www.cnbl ...
- js 弹窗的实现
原理: 1. 点击按钮,触发窗口显示,遮罩层显示,并设置窗口的位置 2. 为弹出的窗口绑定鼠标滚动事件和视窗改变事件 3.点击关闭按钮,弹窗消失,遮罩层消失 html 代码: <!DOCTYPE ...
- angular的启动原理
当你用浏览器去访问index.html的时候,浏览器依次做了如下一些事情: 加载html,然后解析成DOM: 加载angular.js脚本:加载完成后自执行,生成全局angular对象,监听DOMCo ...
- webstorm添加多个项目
在webstorm工作目录下,添加其他项目,不用每个项目打开一个webstorm,刚开始使用webstorm的时候,每次打开一个项目的时,都要打开一个开发界面,在这几个窗口之间来回的切换,有一天真的感 ...
- 何谓domReady
我的博客已经写过好几篇如何实现domReady的文章,最近做培训,面向新手们,需要彻彻底底向他们说明这个东西,于是就有了这篇文章. 我们经常看人们用 document.getElementById(& ...