Problem Id Title
  Problem A A+B
  Problem B 统计字数
  Problem C 生日计算
  Problem D 冬瓜的寒假之旅

Problem A(略)

Problem B

B题目就是一个统计字符的简单模拟,纵向记录横向输出就可。先for一圈遍历遍最大的个数可确定高度。

 /****************************************/
/***** Desgard_Duan *****/
/****************************************/
//#pragma comment(linker, "/STACK:102400000,102400000")
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <algorithm>
#include <stack>
#include <map>
#include <queue>
#include <vector>
#include <set>
#include <functional>
#include <cmath>
#include <numeric> using namespace std; vector<string> ans;
int let[]; int main () {
string text = "", in;
for (int i = ; i < ; ++ i) {
getline(cin, in);
text += in;
}
//cout << text << endl;
memset (let, , sizeof (let));
int Max = ;
for (int i = ; i < text.size(); ++ i) {
if (isalpha(text[i])) {
let[text[i] - 'A'] ++;
Max = max (Max, let[text[i] - 'A']);
}
}
for (int i = ; i <= Max; ++ i) {
string text_line = "";
for (int j = ; j < ; ++ j) {
if (i > Max - let[j]) {
text_line += "*";
} else {
text_line += " ";
}
if (j != ) text_line += " ";
}
cout << text_line << endl;
}
puts("A B C D E F G H I J K L M N O P Q R S T U V W X Y Z");
return ;
}

Problem C

考虑闰年的2月29日生日就可,其他没有什么坑。

 /****************************************/
/***** Desgard_Duan *****/
/****************************************/
//#pragma comment(linker, "/STACK:102400000,102400000")
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <algorithm>
#include <stack>
#include <map>
#include <queue>
#include <vector>
#include <set>
#include <functional>
#include <cmath>
#include <numeric> using namespace std; int judge( int x ) {
if( x % == || ( x % == && x % != ) )
return ;
return ;
}
int main() {
int y, m, d, t;
while(scanf( "%d", &t ) != EOF) {
while( t-- ) {
scanf( "%d-%d-%d", &y, &m, &d );
int sum = ;
if( judge( y ) && m == && d == && !judge( y + ) ) {
puts( "-1" );
continue;
}
for( int i = ; i <= ; ++i )
if(judge( y + i ))
sum ++;
if( judge( y + ) && m <= && d < )
--sum;
if( judge( y ) && m >= )
--sum;
printf( "%d\n", sum + * );
}
}
return ;
}

Problem D

主要考察枚举法。即全排列。在数据量不大的情况下,即可将TSP问题的所有情况全部列出,寻求最佳值。

另外可以学习一下next_permutation函数的用法,白书中也有介绍。

 #include <cstring>
#include <iostream>
#include <cstdlib>
#include <cctype>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue> using namespace std; int per[]; struct point {
double x, y;
} p[]; double dis(point a, point b) {
return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
} int main() {
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
int T, n, cas = ;
double ans;
bool f;
scanf("%d", &T);
while(T--) {
f = true;
scanf("%d", &n);
for(int i = ; i <= n; ++i) {
scanf("%lf%lf", &p[i].x, &p[i].y);
}
for(int i = ; i <= n; ++i) {
per[i - ] = i;
}
do {
point tmp;
tmp.x = ;
tmp.y = ;
double sum = dis(tmp, p[per[]]);
for(int i = ; i < n; ++i) {
sum += dis(p[per[i]], p[per[i - ]]);
}
sum += dis(tmp, p[per[n - ]]);
if(f) {
ans = sum;
f = false;
} else
ans = min(ans, sum);
} while(next_permutation(per, per + n));
printf("Case #%d: %.2lf\n", cas++, ans);
}
return ;
}

Contest - 第10届“新秀杯”ACM程序设计大赛现场热身赛 赛后信息(题解)的更多相关文章

  1. Contest - 第10届“新秀杯”ACM程序设计大赛网络预选赛 赛后信息(晋级名单)

    经过比赛结果以及综合评定,以下42名同学暂定出现.下为出现名单(打*为 友情参赛 或为 有重大作弊嫌疑的选手). 在即日24时之前,若有异议,仍可申诉,申诉邮箱:desgard_duan@foxmai ...

  2. Contest - 第10届“新秀杯”ACM程序设计大赛网络资格赛 赛后信息(晋级名单·正式版)

    2014_acm_fresh_0057 刘畅 20131620 2014_acm_fresh_0099 汪哲 20132185 2014_acm_fresh_0086 陈顺 2014111776 20 ...

  3. “玲珑杯”第七届郑州轻工业学院ACM程序设计大赛 ------- D:社交网络

    题目链接: http://acm.zzuli.edu.cn/problem.php?cid=1099&pid=3 题目大意: 国语题目,题意显而易见, 解题思路: 只需要对每一个节点进行假设, ...

  4. 计算机学院2014年“新生杯”ACM程序设计大赛

    1440: 棋盘摆车问题 对于输入n,k: 1.当n<k时,无满足的摆法 2.否则 第一个车可以排n*n个位置(即整个棋盘),第二个可排(n-1)*(n-1)个位置,…… 正如排列组合一样,车与 ...

  5. 第13届 广东工业大学ACM程序设计大赛 C题 平分游戏

    第13届 广东工业大学ACM程序设计大赛 C题 平分游戏 题目描述 转眼间又过了一年,又有一届的师兄师姐要毕业了. ​ 有些师兄师姐就去了景驰科技实习. 在景驰,员工是他们最宝贵的财富.只有把每一个人 ...

  6. 第十一届GPCT杯大学生程序设计大赛完美闭幕

    刚刚过去的周六(6月7号)是今年高考的第一天,同一时候也是GPCT杯大学生程序设计大赛颁奖的日子,以下我们用图文再回想一下本次大赛颁奖的过程. 评审过程的一些花絮<感谢各位评审这些天的付出!&g ...

  7. 西南科技大学第十一届ACM程序设计大赛发言稿

    西南科技大学第十一届ACM程序设计大赛发言稿 各位老师.志愿者及参赛选手: 大家好,我是来自计科学院卓软1301的哈特13,很荣幸今天能站在这里代表参赛选手发言. 回想起来,我参加ACM比赛已经快两年 ...

  8. nyoj 1238 最少换乘 (河南省第八届acm程序设计大赛)

    题目1238 题目信息 执行结果 本题排行 pid=1238" style="text-decoration:none; color:rgb(55,119,188)"&g ...

  9. nyoj 1239 引水project (河南省第八届acm程序设计大赛)

    题目1239 pid=1239" style="color:rgb(55,119,188)">题目信息 pid=1239" style="col ...

随机推荐

  1. Android实现计时与倒计时(限时抢购)的几种方法

    在购物网站的促销活动中一般都有倒计时限制购物时间或者折扣的时间,这些都是如何实现的呢? 在一个安卓客户端项目中恰好遇到了类似的问题,一开始使用的是Timer与 TimerTask, 虽然此方法通用,但 ...

  2. 生成唯一的id(转)

    很多朋友都利用md5()来生成唯一的编号,但是md5()有几个缺点:1.无序,导致数据库中排序性能下降.2.太长,需要更多的存储空间.其实PHP中自带一个函数来生成唯一的id,这个函数就是uniqid ...

  3. MaterialDialog的用法:

    MaterialDialog的用法:/** * * @author smiling * @date 2016/10 */ Github:https://github.com/drakeet/Mater ...

  4. mysql02

    -- 查询课程名称 和年级的名称 -- 非等值连接查询 SELECT subjectname,gradeName FROM `subject`,grade -- 等值连接查询 SELECT subje ...

  5. adb服务无法启动

    今天学习android编程发现调试出错 The connection to adb is down, and a severe error has occured. You must restart ...

  6. AngularJs学习html转义

    MainApp.directive('ngHtml', function () { function watch(scope, el, watchExp){ scope.$watch(watchExp ...

  7. asp.net程序中如何使用皮肤更换的小功能

    写这篇文章,因要往OA系统上添加更换主题的功能,在网上仔细搜索了一下,主要有几种方法可以实现, 第一种:使用原生态javascript+Css来实现,(代码多,看着纠结,对于前台不熟悉的程序员来说看深 ...

  8. swift 重载 泛式 inout的使用

    swift 重载 泛式 inout的使用 函数 func 关键字 -> 表示返回值信息等等 那我们接下来利用函数做几件事情 -a 比较两个数字的大小 -b 比较两个字符串 -c 既能比较字符串, ...

  9. Spring静态属性注入

    今天遇到一个工具类,需要静态注入一个属性,方法如下: 第一步:属性的set和get方法不要加static package cn.com.chinalife.ebusiness.common.util; ...

  10. Java学习笔记——SequenceInputStream类合并文件的综合举例分析

    SequenceInputStream 介绍 SequenceInputStream 类表示其他输入流的逻辑串联,即文件的合并. 它从输入流的有序集合开始,并从第一个输入流开始读取,直到到达文件末尾, ...