BestCoder Round #50 (div.2)(hdu 5364,hdu 5365,hdu 5366)
来源:互联网 发布:时空软件 编辑:程序博客网 时间:2024/05/16 15:01
Distribution money
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5364
解题思路:http://blog.csdn.net/piaocoder/article/details/47608121
#include <iostream> #include <cstdio> #include <algorithm> using namespace std; int main(){ int n; int a[1005]; while(~scanf("%d",&n)){ for(int i = 0; i < n; i++) scanf("%d",&a[i]); sort(a,a+n); int tmp = a[0]; a[n] = n+1; int sum = 0,sumtmp = 1,maxnum = 0; for(int i = 1; i <= n; i++){ if(tmp == a[i]) sumtmp++; else{ if(sum < sumtmp){ maxnum = a[i-1]; sum = sumtmp; } sumtmp = 1; tmp = a[i]; } } if(sum > n-sum) printf("%d\n",maxnum); else printf("-1\n"); } return 0; }
Run
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5365
解题思路:http://blog.csdn.net/piaocoder/article/details/47608369
#include <iostream> #include <cstdio> #include <algorithm> using namespace std; int x[25],y[25]; int dis(int x1,int y1,int x2,int y2){ return (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2); } int main(){ int n; while(~scanf("%d",&n)){ for(int i = 0; i < n; i++) scanf("%d%d",&x[i],&y[i]); int sum = 0; int d[6]; for(int i = 0; i < n; i++) for(int j = i+1; j < n; j++) for(int k = j+1; k < n; k++) for(int l = k+1; l < n; l++){ d[0] = dis(x[i],y[i],x[j],y[j]); d[1] = dis(x[i],y[i],x[k],y[k]); d[2] = dis(x[i],y[i],x[l],y[l]); d[3] = dis(x[j],y[j],x[k],y[k]); d[4] = dis(x[j],y[j],x[l],y[l]); d[5] = dis(x[k],y[k],x[l],y[l]); sort(d,d+6); if(d[0] == d[1] && d[1] == d[2] && d[2] == d[3] && d[4] == 2*d[0] && d[5] == 2*d[0]) sum++; } printf("%d\n",sum); } return 0; }
The mook jong
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5366
解题思路:http://blog.csdn.net/piaocoder/article/details/47608809
#include <iostream> #include <cstdio> using namespace std; typedef long long ll; ll dp[65]; int main(){ dp[1] = 1;dp[2] = 2;dp[3] = 3; for(int i = 4; i <= 60; i++) dp[i] = dp[i-3]+1+dp[i-1]; int n; while(~scanf("%d",&n)) printf("%lld\n",dp[n]); return 0; }
0 0
- BestCoder Round #50 (div.2)(hdu 5364,hdu 5365,hdu 5366)
- BestCoder Round #52 (div.2)(hdu 5417,hdu 5418)
- 【HDU】BestCoder Round #11 (Div. 2)
- hdu 5600 BestCoder Round #67 (div.2)
- hdu 5637 BestCoder Round #74 (div.2)
- BestCoder Round #50 (div.2) HDU 5365 Run(简单几何)
- BestCoder Round #58 (div.2)(hdu 5494,hdu5495,hdu5496)
- hdu 5563 BestCoder Round #62 (div.2)
- HDU 5671 Matrix (BestCoder Round #81 (div.2) 1002)
- BestCoder Round #79 (div.2) hdu 5660 ,hdu 5661
- HDU 5365 Run ——BestCoder Round #50(div.1 div.2)
- HDU 5366 The mook jong——BestCoder Round #50(div.1 div.2)
- HDU 5364 Distribution money——BestCoder Round #50(div.2)
- BestCoder Round #82 (div.2) (HDU 5675)(HDU 5676)
- BestCoder Round #11 (Div. 2) Argestes and Sequence (hdu 5057)
- BestCoder Round #54 (div.2) hdu 5428 求质因数
- BestCoder Round #54 (div.2) HDU 5428 The Factor(1002)
- BestCoder Round #54 (div.2)HDU 5429 Geometric Progression(1003)
- 《动物庄园》读后感
- Java Web项目中连接Access数据库的配置方法
- 学习shencha-touch
- 九度 Online Judge 算法 刷题 题目1050:完数
- Monkey测试log分析二
- BestCoder Round #50 (div.2)(hdu 5364,hdu 5365,hdu 5366)
- 大讲台谈Hadoop启动常见的问题及解决方案(二)
- RPG2.0战斗框架学习5之目标被击处理
- Activity的四种启动模式和onNewIntent()
- windows下面配置apache+https(利用SSL)服务器
- 做一个温婉/儒雅的女汉子程序媛
- 用PYTHON写一个应用程序并发布exe
- 一键返回顶部
- sort与stable_sort