ACM主办的国际大学生程序设计竞赛-浙江农林大学暨阳学院.ppt

ACM主办的国际大学生程序设计竞赛-浙江农林大学暨阳学院.ppt

ACM主办的国际大学生程序设计竞赛-浙江农林大学暨阳学院

* * 一、编译错误 Main函数必须返回int类型(正式比赛) 不要在for语句中定义类型 __int64不支持,可以用long long代替 使用了汉语的标点符号 itoa不是ansi函数 能将整数转换为字符串而且与ANSI标准兼容的方法是使用sprintf()函数 int num = 100; ??? char str[25]; ??? sprintf(str, %d , num); 另外,拷贝程序容易产生错误 * * 下面的hdoj1089为什么 CE? #include stdio.h int main() { int a,b; while(scanf(%d %d,a, b) != EOF) printf(%d\n,a+b); } * * 二、小技巧 数据的拷贝(特别是输出的提示信息) 调试的sample input的拷贝 * * 三、C语言处理“混合数据”的问题 例题(Hdoj_1170) /showproblem.php?pid=1170 * * 常见的代码: …… scanf(%d\n,icase); for (i=0;iicase;i++) { scanf(%c%d%d,opera,num1,num2); …… } …… * * 有什么问题? * * 四、Printf和cout混用的问题 以下的程序输出什么? #includestdio.h #includeiostream.h int main() { int j=0; for(j=0;j5;j++) { coutj=; printf(%d\n,j); } return 0; } * * 为什么? 一个带缓冲输出(cout) 一个不带缓冲输出(printf) * * 五、输入输出原理 Input 1 5 2 6 10 20 111 111 321 123 Output 6 8 30 222 444 * * 思考题(目的:初步体会一下ACM的魅力) Given two non-negative integers m and n, you will have to find the last digit of mn in decimal number system. Input The input file contains several lines. Each line contains two integers m and n (both less than 101001). Input is terminated by a line containing two zeroes. This line should not be processed. Output For each set of input you must produce one line of output which contains a single digit. This digit is the last digit of mn. Sample Input 3 2 3 5 0 0 Sample Output 9 3 * * 授课方式与成绩评定 介绍常用算法 举例分析 上机练习(自己在线练习) 成绩评定:机试 ( 5 ~ 6 题 ) * * 相关资料 数学知识 离散、组合 数论、图论 计算几何 算法数据结构 基本数据结构 搜索、分治 动态规划 贪心…… * * 学习方式 练习-总结-练习-总结-…… 杭电ACM论坛 google、baidu * * / 去哪里练习? * * 常见问题: 1、需要什么基础?( C/C++ ) 4 、可以退课吗? ( Of course! ) 3 、如何加入集训队? (200 申请 ) 2、英语不好怎么办?(问题不大) * * 想对大家说的话… * * 课后任务: 1、熟悉 2、完成在线练习: 《ACM Programming》Exercise(1) 3、学有余力,可以尝试下面题目: 1016-1018、1013、1061 1170、2000-2043 * * See you next week! * * * * * * ACM题目特点: 由于ACM竞赛题目的输入数据和输出数据一般有多组(不定),并且格式多种多样,所以,如何处理题目的输入输出是对大家的一项最基本的要求。这也是困扰初学者的一大问题。 下面,分类介绍: * * 先看一个超级简单的题目: /showproblem.php?pid=1089 Sample input: 1 5 10 20 Sample output: 6 30 * * 初学者很常见的

文档评论(0)

1亿VIP精品文档

相关文档