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 ...
随机推荐
- js 简单算法
1. 嵌套数组打平并且去重 ,,,,,,,,[,,,,[,,]]]; var obj = {};//去重标识 function test(data) { var newArr = []; for ( ...
- js人形时钟
https://blog.csdn.net/rsylqc/article/details/44808063 分享自:http://chabudai.org/blog/?p=59 在这个网站看到一个很有 ...
- 用URL传递参数
用URL传递参数,在园子里找到一篇文章解决了自己的问题,地址如下:http://www.cnblogs.com/lolicon/archive/2009/01/19/1378408.html
- class 方法
实例对象调用class方法时返回这个实例对象的isa指针,也就是对应的类对象: 类对象调用class方法时返回这个类对象本身. (注:如果想一直获得一个类的类对象,也就是isa指针,可以调用runti ...
- 关于cordova 状态栏设置
https://blog.csdn.net/u011127019/article/details/58104056
- python流程控制for循环
流程控制 for循环 #首先我们用一例子看下用while循环取出列表中值的方法 l=['a','b','c'] i=0 while i<len(l): print(l[i]) i+=1 #whi ...
- Error building Player: Exception: Could not start java
4.6.1发布Flash版本出错.解决方法:把C:\Windows\System32\java.exe复制到C:\Windows\SysWOW64下即可
- sqlalchemy学习-- 重要参数
Base = declarative_base 基类: 1.存储表 2.建立class-Table 的映射关系 engine = create_engine('mysql://root:root@lo ...
- 全局异常 同时ajax或是web跳转
F8功能强大 在java代码debug的时候,F8键可直接跳到下一个类中.免去下一步 只用把之前两种方式合并即可,就是在exception包中不要ajax的异常,将其放入到web异常中,用if ...
- IDEA 中的一些概念变化
IntelliJ系中的Project相当于Eclipse系中的workspace. IntelliJ系中的Module相当于Eclipse系中的Project. idea中只能配置一个maven,而且 ...