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. monkeyrunner 详细介绍

    MonkeyRunner: monkeyrunner工具提供了一个API,使用此API写出的程序可以在Android代码之外控制Android设备和模拟器.通过monkeyrunner,您可以写出一个 ...

  2. 关于“无法解析的外部符号”和“该符号在函数_wmain 中被引用”的问题

    在VS2008和opendv的环境下: error LNK2019: 无法解析的外部符号_cvDestroyWindow,该符号在函数_wmain 中被引用 error LNK2019: 无法解析的外 ...

  3. 使用MFC读写Excel

    _Application m_ExlApp;   //组件服务器的各个classes     _Workbook m_ExlBook;     Workbooks m_ExlBooks;     _W ...

  4. Environment Configuration Files

    Environment Configuration Files When a user logs in, an environment is created for that user automat ...

  5. javascript MD5

    var MD5 = function (string) { function RotateLeft(lValue, iShiftBits) { return (lValue<<iShift ...

  6. C++标准库<string>简单总结

    C++标准库<string>简单总结 在C++中,如果需要对字符串进行处理,那么它自带的标准库<string>无疑是最好的选择,它实现了很多常用的字符处理函数. 要想使用标准C ...

  7. DHCP租约时间工作原理

    问题:    很多用户在使用路由器的DHCP服务器过程中都有一个疑问,DHCP有个设置项目是设置DHCP地址的租约时间,如果设置的比较短,是否会出现租约时间到了以后会重新去获取ip地址,造成用户断网? ...

  8. Zend Framework

    参考:http://www.php100.com/manual/ZendFramework/index.html 1.1. 概述 Zend Framework (ZF) 是一个开放源代码的 PHP5 ...

  9. zepto源码研究 - ajax.js($.ajax具体流程分析)

    简要:$.ajax是zepto发送请求的核心方法,$.get,$.post,$.jsonp都是封装了$.ajax方法.$.ajax将jsonp与异步请求的代码格式统一起来,内部主要是先处理url,数据 ...

  10. Leetcode 371: Sum of Two Integers(使用位运算实现)

    题目是:Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -. ...