ACM小白入门

来源:互联网 发布:黑马java基础班测试题 编辑:程序博客网 时间:2024/05/18 01:47

我放弃了使用了六年的pascal,放弃了学了一学期的java,自学了C++。个人认为使用c++参加acm是最好的选择。

原因如下:
(1)c++代码比pascal和java更加简洁
(2)效率比java要高
(3)学好c++,c的代码你也能看的懂
(4)大部分选手使用的是c++,不会的题目看题解你能看的懂

我用的IDE是codeblocks,简单易用,安装起来也很方便。现在主要是在HDOJ刷题。

codeblocks在官网上就可以下载
选择划红线的codeblocks安装包
安装之后,使用教程:https://jingyan.baidu.com/article/c85b7a640a05c8003bac95a6.html
语言选择C++即可

HDOJ是杭州电子科技大学的在线评测系统,非常出名,题目很多,绝对能满足你的刷题欲望。
网址:http://acm.hdu.edu.cn/

这里写图片描述
做完一个题目拉到题目最下方选择提交

这里写图片描述可以选择自己的语言,G++其实并不是真的一门语言,大家写了C++的代码可以选择G++来提交,亲测通过!!!

阅读本文的是小白,对c++不熟悉,所以我推荐自己的做题顺序供大家参考。如果能按照我的顺序去做,三天足以上手c++,一星期就能十分熟练的使用C++写代码了。

这里写图片描述这是第一页的一系列A+B问题,毫无难度,目的只是为了熟悉语法。

http://acm.hdu.edu.cn/showproblem.php?pid=1089

#include <iostream>using namespace std;int main(){    int a,b;    while(cin>>a>>b) cout<<a+b<<endl;   return 0;}

http://acm.hdu.edu.cn/showproblem.php?pid=1090

#include <iostream>#include <stdio.h>using namespace std;int main(){    int a,b,n;    cin>>n;    while(n--) {        scanf("%d %d",&a,&b);        printf("%d\n",a+b);    }   return 0;}

http://acm.hdu.edu.cn/showproblem.php?pid=1091

#include <iostream>#include <stdio.h>using namespace std;int main(){    int a,b;    while(scanf("%d %d" ,&a, &b) && (a!=0 || b!=0)) printf("%d\n",a+b);   return 0;}

http://acm.hdu.edu.cn/showproblem.php?pid=1092

#include <iostream>#include <stdio.h>using namespace std;int main(){    int a,i,n,sum;    while(cin>>n && n) {        sum=0;        for (i=1;i<=n;i++) {            scanf("%d",&a);            sum+=a;        }        printf("%d\n",sum);    }   return 0;}

http://acm.hdu.edu.cn/showproblem.php?pid=1093

#include <iostream>#include <stdio.h>using namespace std;int main(){    int a,i,n,sum,m;    cin>>n;    while (n--){       cin>>m; sum=0;       while(m--) {         scanf("%d",&a);         sum+=a;       }       printf("%d\n",sum);    }   return 0;}

http://acm.hdu.edu.cn/showproblem.php?pid=1094

#include <iostream>#include <stdio.h>using namespace std;int main(){    int a,i,n,sum;    while (~scanf("%d",&n)){       sum=0;       while(n--) {         scanf("%d",&a);         sum+=a;       }       printf("%d\n",sum);    }   return 0;}

http://acm.hdu.edu.cn/showproblem.php?pid=1095

#include <iostream>#include <stdio.h>using namespace std;int main(){    int a,b;    while (~scanf("%d%d",&a,&b)){       printf("%d\n\n",a+b);    }   return 0;}

http://acm.hdu.edu.cn/showproblem.php?pid=1096

#include <iostream>#include <stdio.h>using namespace std;int main(){    int a,b,i,m,n,sum;    scanf("%d",&n);    while (n--){       scanf("%d",&m); sum=0;       for (i=1;i<=m;i++){         scanf("%d",&a);         sum+=a;       }       if(n!=0) printf("%d\n\n",sum);       else printf("%d\n",sum);    }   return 0;}

我把自己写的代码贴了出来作为参考,不懂的语法百度一下,你就知道…..
这些题目做完,就跳转至11页
这里写图片描述如果能一星期内把前24题 都做完,我相信你已经对c++的书写比较熟练了。那么你可以停止刷水题,进入更高层次的学习。(我没做完是因为我已经很熟练了…)

最后有一段话想说说:

**acm对数学要求还是蛮高的,所以做题遇到很多瓶颈很正常,但不要轻言放弃。勇于挑战才能超越自我。做题过程中你可以体验到AC之后的成就感,也会发现数学是多么的富有魅力,希望你能坚持下去。
不过训练是需要耗费大量的时间的,先好好衡量自己的课业和兴趣,别急着尝试。不然中途退出,就完全是在浪费自己的时间,学不到什么东西。**

原创粉丝点击