四川省赛
来源:互联网 发布:js中格式化日期 编辑:程序博客网 时间:2024/05/17 07:38
frog has n integers a1,a2,…,an , and she wants to add them pairwise.
Unfortunately, frog is somehow afraid of carries (进位). She defines \emph{hardness} h(x,y) for adding x and y the number of carries involved in the calculation. For example, h(1,9)=1,h(1,99)=2 .
Find the total hardness adding n integers pairwise. In another word, find∑1≤i<j≤nh(ai,aj) .
//B 统计进位 就是说n个数 如果他们相加需要进位的话就加1 求所有俩俩之间的进位和/*#include<iostream>#include<cstdio>#include<cstring>#include<cstdlib>#include<algorithm>#include<cmath>#include<queue>#include<stack>#include<map>#include<set>#include<vector>using namespace std;typedef long long ll;#define inf 0x3f3f3f3f#define eps 1e-10#define maxl 100010#define mem(i,j) memset(i,j,sizeof(i))int a[maxl],d[maxl][15];int main(){ freopen("in.txt", "r", stdin); int n; while(scanf("%d",&n)!=EOF){ memset(d,0,sizeof(d)); for(int i=0;i<n;i++) { scanf("%d",&a[i]); int temp=a[i]; int cnt=0; while(temp){ d[i][cnt++]=temp%10; temp/=10; } } ll ans=0; vector<int> v; for(int i=0;i<=10;i++){ v.clear(); for(int j=0;j<n;j++){ int res=0; for(int k=i;k>=0;k--){ res=res*10+d[j][k]; } v.push_back(res); } ll sum=1; for(int j=0;j<=i;j++) sum*=10; sort(v.begin(),v.end()); for(int j=0;j<v.size();j++){ ans+=v.size()-(lower_bound(v.begin()+j+1,v.end(),sum-v[j])-v.begin()); } } printf("%lld\n",ans); }}*/
frog has a graph with \(n\) vertices \(v(1), v(2), \dots, v(n)\) and \(m\) edges \((v(a_1), v(b_1)), (v(a_2), v(b_2)), \dots, (v(a_m), v(b_m))\).
She would like to color some vertices so that each edge has at least one colored vertex.
Find the minimum number of colored vertices.
//D 就是一个图 不一定是联通的 让你给点染色 保证所有的边都有至少一个点被染色了/*#include<iostream>#include<cstdio>#include<cstring>#include<cstdlib>#include<algorithm>#include<cmath>#include<queue>#include<stack>#include<map>#include<set>#include<vector>using namespace std;typedef long long ll;#define inf 0x3f3f3f3f#define eps 1e-10#define maxl 510#define mem(i,j) memset(i,j,sizeof(i))int d[maxl][maxl];int res[maxl],vis[maxl];int n,m,ans;bool solve(int u){ for(int v=1;v<=n;v++){ if(vis[v]||!d[u][v]) continue; vis[v]=1; if(res[v]==0||solve(res[v])){//二分图 res[v]=u; return true; } } return false;}int main(){ freopen("in.txt", "r", stdin); while(scanf("%d%d",&n,&m)!=EOF){ memset(d,0,sizeof(d)); memset(res,0,sizeof(res)); ans=0; int u,v; for(int i=0;i<m;i++){ scanf("%d%d",&u,&v); if(d[u][v]) continue; d[u][v]=1;d[v][u]=1; } for(int i=1;i<=n;i++){ memset(vis,0,sizeof(vis)); if(solve(i)) ans++; } printf("%d\n",ans/2); }}*/
0 0
- 四川省赛
- 四川省赛G.Party
- 2017四川省赛总结
- 2015 四川省赛 C. Censor
- 2015 四川省赛 B. Carries
- 2016四川省赛 Floyd-Warshall
- 2016四川省省赛总结
- 2017四川省省赛G
- 2017四川省省赛E
- 2017四川省省赛E
- 2013 四川省赛暨成都邀请赛 总结
- 2015四川省赛 scu oj 4438 Censor
- SOJ 4445 2015四川省赛模拟题
- 2015ACM四川省赛C题
- 2015 四川省赛 B Carries (脑洞题)
- 2015 四川省赛 I Travel(bfs)
- UESTC - 92 Journey(LCA)1012四川省赛
- 弱校联盟 2016 四川省赛
- hdu 5131__Song Jiang's rank list
- 惠普EPM实训-选课管理系统项目总结。
- MySQL check the manual that corresponds to your MySQL server version for the right syntax错误
- 国际化,与近距离感应
- HDU 5477 A Sweet Journey
- 四川省赛
- virtualenv下安装pycurl
- 传输层:UDP 协议,转载自实验楼
- mysql数据类型
- iOS UITextView的使用(小小阅读器实现)
- NSDate
- Ubuntu安装出错(starting restore sound card state)
- Combination Sum
- Neutron LBaaS V1 (by quqi99)