emm,a出3题,补了两题

A,B水题

#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define read(a) scanf("%d",&a)
#define rread(a,b) scanf("%d%d",&a,&b)
#define pii pair<int,int>
#define C 0.5772156649
#define pi acos(-1.0)
#define ll long long
#define mod 1000000007
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1 using namespace std; const double g=10.0,eps=1e-;
const int N=+,maxn=+,inf=0x3f3f3f3f; int main()
{
int n;
read(n);
for(int i=;i<n;i++)
{
int a,b;
rread(a,b);
printf("%d\n",*max(a,b)+min(a,b));
}
return ;
}
/******************** ********************/

A

#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define read(a) scanf("%d",&a)
#define rread(a,b) scanf("%d%d",&a,&b)
#define pii pair<int,int>
#define C 0.5772156649
#define pi acos(-1.0)
#define ll long long
#define mod 1000000007
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1 using namespace std; const double g=10.0,eps=1e-;
const int N=+,maxn=+,inf=0x3f3f3f3f; char s[N];
int main()
{
int n;
read(n);
for(int i=;i<n;i++)
{
int a,b;
scanf("%s",&s);
int len=strlen(s),ans=;
for(int i=;i<len;i++)
{
if(s[i]=='H')ans++;
else if(s[i]=='C')ans+=;
else ans+=;
}
printf("%d\n",ans);
}
return ;
}
/******************** ********************/

B

C:递推,首先想到矩阵快速幂,构造一个7维的矩阵,分别是ai-1,ai-2,i^4,i^3,i^2,i,1,再转移下去

#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define read(a) scanf("%d",&a)
#define rread(a,b) scanf("%d%d",&a,&b)
#define pii pair<int,int>
#define C 0.5772156649
#define pi acos(-1.0)
#define ll long long
#define mod 2147493647
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1 using namespace std; const double g=10.0,eps=1e-;
const int N=+,maxn=+,inf=0x3f3f3f3f; struct Node{
int len;
ll a[N][N];
};
Node mul(Node x,Node y)
{
Node ans;
memset(ans.a,,sizeof ans.a);
ans.len=x.len;
for(int i=;i<x.len;i++)
{
for(int j=;j<x.len;j++)
{
for(int k=;k<y.len;k++)
{
ans.a[i][k]=(ans.a[i][k]+x.a[i][j]*y.a[j][k]%mod)%mod;
}
}
}
return ans;
}
Node quick_mul(Node x,ll n)
{
Node ans;
memset(ans.a,,sizeof ans.a);
ans.len=x.len;
for(int i=;i<x.len;i++)ans.a[i][i]=;
while(n)
{
if(n&)ans=mul(ans,x);
x=mul(x,x);
n/=;
}
return ans;
}
int main()
{
int t;
read(t);
for(int i=;i<t;i++)
{
ll n,x,y;
scanf("%lld%lld%lld",&n,&x,&y);
if(n==)
{
printf("%lld\n",x%mod);
continue;
}
if(n==)
{
printf("%lld\n",y%mod);
continue;
}
Node A;
A.len=;
A.a[][]=,A.a[][]=,A.a[][]=,A.a[][]=,A.a[][]=,A.a[][]=,A.a[][]=;
A.a[][]=,A.a[][]=,A.a[][]=,A.a[][]=,A.a[][]=,A.a[][]=,A.a[][]=;
A.a[][]=,A.a[][]=,A.a[][]=,A.a[][]=,A.a[][]=,A.a[][]=,A.a[][]=;
A.a[][]=,A.a[][]=,A.a[][]=,A.a[][]=,A.a[][]=,A.a[][]=,A.a[][]=;
A.a[][]=,A.a[][]=,A.a[][]=,A.a[][]=,A.a[][]=,A.a[][]=,A.a[][]=;
A.a[][]=,A.a[][]=,A.a[][]=,A.a[][]=,A.a[][]=,A.a[][]=,A.a[][]=;
A.a[][]=,A.a[][]=,A.a[][]=,A.a[][]=,A.a[][]=,A.a[][]=,A.a[][]=;
A=quick_mul(A,n-);
ll ans=A.a[][]*y%mod;
ans=(ans+A.a[][]*x%mod)%mod;
ans=(ans+A.a[][]****%mod)%mod;
ans=(ans+A.a[][]***%mod)%mod;
ans=(ans+A.a[][]**%mod)%mod;
ans=(ans+A.a[][]*%mod)%mod;
ans=(ans+A.a[][]%mod)%mod;
printf("%lld\n",ans);
}
return ;
}
/******************** ********************/

C

G是个二分+积分题,由于关系找错了,导致一直没过,二分水平面和竖直的夹角,用积分求体积和,不倾斜的体积比较

#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define read(a) scanf("%d",&a)
#define rread(a,b) scanf("%d%d",&a,&b)
#define pii pair<int,int>
#define C 0.5772156649
#define pi acos(-1.0)
#define ll long long
#define mod 2147493647
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1 using namespace std; const double g=10.0,eps=1e-;
const int N=+,maxn=+,inf=0x3f3f3f3f; double f(double x)
{
double y=acos(*tan(x)-);
double a1,a2;
a1=pi*cos(y)-y*cos(y)+sin(y)-(1.0/3.0)*sin(y)*sin(y)*sin(y);
y=pi;
a2=pi*cos(y)-y*cos(y)+sin(y)-(1.0/3.0)*sin(y)*sin(y)*sin(y);
return (1.0/tan(x))*(a1-a2);
}
double bs(double x)
{
double l=,r=pi/;
while(r-l>1e-)
{
double m=(l+r)/;
if(f(m)>x)r=m;
else l=m;
}
return l;
}
int main()
{
int t;
scanf("%d",&t);
for(int i=;i<t;i++)
{
double d;
scanf("%lf",&d);
if(d<1e-)
{
printf("%.5f\n",0.0);
continue;
}
double ans=pi*sqrt(+(-d)*(-d));
if(d<)
{
double ang=bs(d*pi);
double p=*tan(ang),ang1=acos(-p),v=ang1-(-p)*sqrt(-(-p)*(-p));
ans=v/sin(ang);
}
printf("%.5f\n",ans);
}
return ;
}
/******************** ********************/

G

E,求点为m个的团有多少个,因为没学过最大团的算法,所以不敢写,补题的时候发现居然dfs就能过= =,直接暴力dfs找到含m个点的团就退出

#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define read(a) scanf("%d",&a)
#define rread(a,b) scanf("%d%d",&a,&b)
#define pii pair<int,int>
#define C 0.5772156649
#define pi acos(-1.0)
#define ll long long
#define mod 2147493647
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1 using namespace std; const double g=10.0,eps=1e-;
const int N=+,maxn=+,inf=0x3f3f3f3f; bool ok[N][N];
int contain[N],ans;
int n,m,s;
vector<int>v[N];
void dfs(int u,int a[],int sz)
{
if(sz==s)
{
ans++;
return ;
}
for(int i=;i<v[u].size();i++)
{
bool f=;
for(int j=;j<sz;j++)
{
if(!ok[v[u][i]][a[j]])
{
f=;
break;
}
}
if(!f)
{
a[sz++]=v[u][i];
dfs(v[u][i],a,sz);
sz--;
}
}
}
int main()
{
int t;
read(t);
for(int i=;i<t;i++)
{
rread(n,m);read(s);
for(int i=;i<=n;i++)v[i].clear();
memset(ok,,sizeof ok);
while(m--)
{
int a,b;
rread(a,b);
if(a>b)swap(a,b);
v[a].pb(b);
ok[a][b]=ok[b][a]=;
}
ans=;
for(int i=;i<=n;i++)
{
// memset(contain,0,sizeof contain);
contain[]=i;
dfs(i,contain,);
}
printf("%d\n",ans);
}
return ;
}
/******************** ********************/

E

2016ACM/ICPC亚洲区沈阳站的更多相关文章

  1. HDU 5950 Recursive sequence 【递推+矩阵快速幂】 (2016ACM/ICPC亚洲区沈阳站)

    Recursive sequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Other ...

  2. HDU 5952 Counting Cliques 【DFS+剪枝】 (2016ACM/ICPC亚洲区沈阳站)

    Counting Cliques Time Limit: 8000/4000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) ...

  3. HDU 5948 Thickest Burger 【模拟】 (2016ACM/ICPC亚洲区沈阳站)

    Thickest Burger Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)T ...

  4. HDU 5949 Relative atomic mass 【模拟】 (2016ACM/ICPC亚洲区沈阳站)

    Relative atomic mass Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Oth ...

  5. 2016ACM/ICPC亚洲区沈阳站-重现赛赛题

    今天做的沈阳站重现赛,自己还是太水,只做出两道签到题,另外两道看懂题意了,但是也没能做出来. 1. Thickest Burger Time Limit: 2000/1000 MS (Java/Oth ...

  6. 2016ACM/ICPC亚洲区沈阳站 - A/B/C/E/G/H/I - (Undone)

    链接:传送门 A - Thickest Burger - [签到水题] ACM ICPC is launching a thick burger. The thickness (or the heig ...

  7. 2016ACM/ICPC亚洲区沈阳站-重现赛

    C.Recursive sequence 求ans(x),ans(1)=a,ans(2)=b,ans(n)=ans(n-2)*2+ans(n-1)+n^4 如果直接就去解...很难,毕竟不是那种可以直 ...

  8. HDU 5950 - Recursive sequence - [矩阵快速幂加速递推][2016ACM/ICPC亚洲区沈阳站 Problem C]

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5950 Farmer John likes to play mathematics games with ...

  9. HDU 5954 - Do not pour out - [积分+二分][2016ACM/ICPC亚洲区沈阳站 Problem G]

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5954 Problem DescriptionYou have got a cylindrical cu ...

  10. 2016ACM/ICPC亚洲区沈阳站 Solution

    A - Thickest Burger 水. #include <bits/stdc++.h> using namespace std; int t; int a, b; int main ...

随机推荐

  1. dbUtils 工具类介绍

    导包: commons-dbutils.jar 核心类: QueryRunner 常用方法: // 执行增,删,改语句, 返回影响的行数 int update(String sql,Object... ...

  2. MySql 批处理

    1. 批处理 批处理只针对更新(增,删,改)语句. MySql 的批处理默认是关闭的, 需要在 url 中配置参数: jdbc:mysal://localhost:3306/mydb1?rewrite ...

  3. where VS having

    where 和 having 的区别:        WHERE 子句不能包含聚集函数: 因为试图用聚集函数判断那些行输入给聚集运算是没有意义的.相反,HAVING 子句总是包含聚集函数    hav ...

  4. ansible的主机变量

    ansible的主机变量(常用):ansible_ssh_host     #用于指定被管理的主机的真实IPansible_ssh_port     #用于指定连接到被管理主机的ssh端口号,默认是2 ...

  5. Django工作小笔记

    场景一:如果model中字段用CharField,然而你想用数字(类似IntegerField)排序,此时可以用django的extra函数直接调用原生sql的CAST函数即可 Score.objec ...

  6. 【WEB】前段优化

    模块化管理: sea.js, require.js 压缩:r.js gulp.js, grunt.js 加速:cdn

  7. MySQL basics

    @1: MySQL有三大类数据类型, 分别为数字.日期\时间.字符串, 这三大类中又更细致的划分了许多子类型: 数字类型 整数: tinyint.smallint.mediumint.int.bigi ...

  8. Adjust Linux Mint Mouse Scroll (Normal/Reverse)

    Set Scroll Normal 1 echo "pointer = 1 2 3 4 5 6 7 8 9 10 11 12" > ~/.Xmodmap && ...

  9. hostname -f 失败解决办法

    $ hostname fzk $ uname -n fzk 当 hostname -f 时报错:未搜索到主机名 产生这个原因时因为  /etc/hosts和/etc/sysconfig/network ...

  10. java屏幕截取

    CaptureScreen.java ```import java.awt.Dimension; import java.awt.Rectangle; import java.awt.Robot; i ...