前言
全暴力第9了解一下,
成绩
RankRankRank是有算别人的
RankRankRank | PersonPersonPerson | ScoreScoreScore | AAA | BBB | CCC |
---|---|---|---|---|---|
999 | 2017myself2017myself2017myself | 71.471.471.4 | 36.436.436.4 | 303030 | 555 |
999 | 2017xxy2017xxy2017xxy | 71.471.471.4 | 36.436.436.4 | 303030 | 555 |
111111 | 2017zyc2017zyc2017zyc | 66.466.466.4 | 36.436.436.4 | 303030 | 000 |
131313 | 2017lrz2017lrz2017lrz | 56.456.456.4 | 36.436.436.4 | 202020 | 000 |
141414 | 2017hzb2017hzb2017hzb | 46.446.446.4 | 36.436.436.4 | 101010 | 000 |
191919 | 2017lw2017lw2017lw | 101010 | 000 | 101010 | 000 |
232323 | 2017xjq2017xjq2017xjq | 000 | 000 | 000 | 000 |
232323 | 2017hjq2017hjq2017hjq | 000 | 000 | 000 | 000 |
正题
T1:jzoj2700−T1:jzoj2700-T1:jzoj2700−数字【数论,LCM,LCM,LCM】
数论神题
博客链接:
https://blog.csdn.net/Mr_wuyongcong/article/details/85207199
T2:jzoj3511−czaT2:jzoj3511-czaT2:jzoj3511−cza的蛋糕【状态压缩dp,dfsdp,dfsdp,dfs】
状压神题
博客链接:
https://blog.csdn.net/Mr_wuyongcong/article/details/85207614
T3:jzoj3519−T3:jzoj3519-T3:jzoj3519−灵能矩阵【LCM,LCM,LCM,树形dpdpdp】
怎么这么多LCM
博客链接:
https://blog.csdn.net/Mr_wuyongcong/article/details/85208305
someofcodesome\ of\ codesome of code
T1 36.4分code
#include<cstdio>
using namespace std;
int n,f[1000000];
int D(int x)
{if(x<10) return x;int sum=0;while(x) sum+=x%10,x/=10;return D(sum);
}
int main()
{scanf("%d",&n);for(int i=1;i<=1000000;i++){for(int j=1;j<=9;j++)if(D(i/j)==j&&i%j==0){f[i]=1;break;}f[i]+=f[i-1];}while(n--){int l,r;scanf("%d%d",&l,&r);printf("%d\n",f[r]-f[l-1]);}
}
T2 30分code
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#define N 75
#define MS 138
using namespace std;
int a[N][N],ans,n,m;
bool check()
{for(int i=1;i<=n;i++)for(int j=1;j<=m;j++)if(a[i][j]&&(a[i+1][j]||a[i][j+1])) return false;return true;
}
void dfs(int x,int y,int c)
{int mx,my;if(c==ans) return;if(x==n&&y==m&&check()){ans=c;return;}else if(x==n&&y==m) return;if(x==n) mx=1,my=y+1;else mx=x+1,my=y;dfs(mx,my,c);if(!a[x][y])return;if(a[x+1][y]){a[x+1][y]=0;a[x][y]=0;dfs(mx,my,c+1);a[x+1][y]=1;a[x][y]=1;}if(a[x][y+1]){a[x][y+1]=0;a[x][y]=0;dfs(mx,my,c+1);a[x][y+1]=1;a[x][y]=1;}
}
int main()
{freopen("cake.in","r",stdin);freopen("cake.out","w",stdout);scanf("%d%d",&n,&m);for(int i=1;i<=n;i++)for(int j=1;j<=m;j++){char c;cin>>c;a[i][j]=(c=='.');}ans=2147483647;dfs(1,1,0);printf("%d",min(ans,max(n,m)));
}
T3 5分code
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
const int N=100010;
vector<int> a[N];
int n,x,y,w[N],ans;
bool cmp(int x,int y)
{return w[x]<w[y];}
void dp(int x)
{if(!a[x].size()) return;for(int i=0;i<a[x].size();i++)dp(a[x][i]);sort(a[x].begin(),a[x].end(),cmp);int sw=w[a[x][0]];for(int i=1;i<a[x].size();i++){int y=a[x][i];ans+=w[y]-sw;}w[x]=sw*a[x].size();
}
int main()
{freopen("pylon.in","r",stdin);freopen("pylon.out","w",stdout);scanf("%d",&n);for(int i=1;i<=n;i++)scanf("%d",&w[i]);for(int i=1;i<n;i++){int x,y;scanf("%d%d",&x,&y);a[x].push_back(y);}dp(1);printf("%d",ans);
}
尾声
暴力出奇迹