博客
关于我
2020.10.17 【NOIP2014】普及组模拟赛总结 (水)
阅读量:340 次
发布时间:2019-03-04

本文共 2171 字,大约阅读时间需要 7 分钟。

在这里插入图片描述

cake

#include
#include
#include
#include
using namespace std;long long n,a[1000111],x;long long ans;int main(){ freopen("cake.in","r",stdin); freopen("cake.out","w",stdout); cin>>n; for(int i=1; i<=n; i++) scanf("%lld",&a[i]); sort(a+1,a+1+n); for(int i=n-1; i>=1; i--) ans+=(n-i)*a[i]; cout<

在这里插入图片描述

chess

#include
#include
#include
#include
using namespace std;int a[110][110];int n,m,c;int main(){ freopen("chess.in","r",stdin); freopen("chess.out","w",stdout); cin>>n>>m; for(int i=1; i<=n; i++) for(int j=1; j<=m; j++) { scanf("%1d",&a[i][j]); if(a[i][j]==1) c++; } if(n==3&&m==4) cout<

在这里插入图片描述

sam

#include
#include
#include
#include
using namespace std;int jyh[100010][20];int k,ans;int dfs(int dep,int cw){ if(jyh[dep][cw]) return jyh[dep][cw]%1000000007; for(int i=max(0,cw-2); i<=min(9,cw+2); i++) jyh[dep][cw]=(jyh[dep][cw]+dfs(dep+1,i))%1000000007; return jyh[dep][cw]%1000000007;}int main(){ freopen("sam.in","r",stdin); freopen("sam.out","w",stdout); cin>>k; if(k==1) { cout<<10; return 0; } for(int i=0; i<=9; i++) jyh[k+1][i]=1; for(int i=1; i<=9; i++) ans=(ans+dfs(2,i))%1000000007; cout<

在这里插入图片描述

similarity

#include
#include
#include
#include
using namespace std;int b[301][301],a[301][301];int shul[10],v[301],ans;int n,m,x,y;int se_ans(){ int js=0; for(int i=1; i<=n; i++) for(int j=1; j<=n; j++) { if(a[i][j]==1&&b[shul[i]][shul[j]]==1) js+=min(a[i][j],b[shul[i]][shul[j]]); } return js;}void bt(int x){ if(x>n) { ans=max(ans,se_ans()); return; } for(int i=1; i<=n; i++) { if(!v[i]) { v[i]=1; shul[x]=i; bt(x+1); v[i]=0; } }}int main(){ //freopen("similarity.in","r",stdin); //freopen("similarity.out","w",stdout); cin>>n>>m; for(int i=1; i<=m; i++) { scanf("%d %d",&x,&y); a[x][y]++; } for(int i=1; i<=m; i++) { scanf("%d %d",&x,&y); b[x][y]++; } bt(1); cout<

转载地址:http://wxle.baihongyu.com/

你可能感兴趣的文章
caffe训练的时候遇到的text-format 错误解决方案。
查看>>
Java 8新特性(一):Lambda表达式
查看>>
ZOJ问题(坑死了)
查看>>
Fire Net(dfs)
查看>>
Little Zu Chongzhi's Triangles
查看>>
算法入门
查看>>
cf-A. Wet Shark and Odd and Even(水)
查看>>
How many ways(记忆化搜索)
查看>>
Train Problem II(卡特兰数+大数乘除)
查看>>
Ignatius and the Princess II(全排列)
查看>>
一些技术博客
查看>>
技术分享 | MySQL 8.0:字符集从 utf8 转换成 utf8mb4
查看>>
第01问:MySQL 一次 insert 刷几次盘?
查看>>
分布式 | DBLE 3.20.07.0 来啦!
查看>>
分布式 | Prepare Statement 协议游标可行性
查看>>
智能在线考试系统
查看>>
振荡器指标
查看>>
单片机之晶振
查看>>
Altium Designer PCB布线之差分对手动设置方法
查看>>
libvirtd:内部错误:Failed to apply firewall rule
查看>>