九度OJ
文章平均质量分 51
HugoWen
热爱开源,崇尚自由。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
九度OJ 1089 数字反转
题目链接:http://ac.jobdu.com/problem.php?pid=1089 题目分析: 使用队列存放每一位的数字,然后输出并计算得到反转数值,从而实现数字反转。 源代码: #include #include using namespace std; int main() { int n; cin>>n; int m = 1; while (m原创 2013-06-07 12:37:54 · 1309 阅读 · 0 评论 -
九度OJ 1003 A+B
题目链接:http://ac.jobdu.com/problem.php?pid=1003 题目分析: 使用A,B两个字符串存储输入的两组数据,首先剔除掉非数字符号,求得数字的值。然后判断正负号,若有负号,则必在串首,判断后得出数据的值,进行计算。 源代码: #include #include using namespace std; int main() { st原创 2013-05-17 15:46:39 · 1000 阅读 · 0 评论 -
九度OJ 1019 简单计算器
题目链接: http://ac.jobdu.com/problem.php?pid=1019 题目分析: 使用两个栈,一个存储数字数据,一个存储操作符号。判断*和/的时候,不入栈,直接通过判断计算前后数字乘除法操作后的值,顺序入数字栈。操作符栈最后只存储+和-符号。 都入栈完毕之后,由于是中缀表达式计算,计算顺序从左至右,这就需要将栈中数据逆置,采用导出到数组的方法。导出完毕后,依次原创 2013-05-16 18:47:22 · 1470 阅读 · 0 评论 -
九度OJ 1055 数组逆置
题目链接:http://ac.jobdu.com/problem.php?pid=1055 题目分析: 简单的数组逆置,输入string字符串,使用for循环逆序输出。 源代码: #include #include using namespace std; int main() { string s; while (cin>>s) { for (int i =原创 2013-06-10 23:10:25 · 850 阅读 · 0 评论 -
九度OJ 1510 替换空格
题目链接:http://ac.jobdu.com/problem.php?pid=1510 题目分析: 使用getline(cin,s)读取输入的字符串以读入空格。 源代码: #include #include using namespace std; int main() { string s; //转化前字符串 while (getline(cin, s)) {原创 2014-01-19 23:10:36 · 823 阅读 · 0 评论 -
九度OJ1096 日期差值
题目链接:http://ac.jobdu.com/problem.php?pid=1096 题目分析: 这题是交大的一年的机试题,不难,不过需要考虑的比较详细。 我设计的程序的思想是,首先判断两年是否在同一年,然后再判断两年是否在同一月,然后进行日期差值的计算。这里要注意天数的差值的加1问题。同时还要在每一种情况下考虑闰年二月天数的问题。我使用数组存储每个月的天数,然后在计算的时候首原创 2013-06-10 10:57:42 · 1372 阅读 · 0 评论 -
九度OJ 1018 统计同成绩学生人数
题目链接:http://ac.jobdu.com/problem.php?pid=1018 题目分析: 依次输入成绩到数组里,注意数组大小为1000,再比对给定成绩,得出人数。 源代码: #include using namespace std; int main() { int n; while (cin>>n) { if (n == 0) { b原创 2013-05-20 00:03:42 · 1189 阅读 · 0 评论 -
九度OJ 1185 特殊排序
题目链接:http://ac.jobdu.com/problem.php?pid=1185 题目分析: 简单的数字排序。 要注意输出的格式,我就因为格式的问题出现了一次Presentation Error。还要注意题目的理解,它说的很不清楚,就是当存在几个一样的数字同时都是最大数的话,只剔除1个就可以,全剔除会WA。 源代码: #include #include us原创 2013-05-17 17:43:26 · 1798 阅读 · 0 评论 -
九度OJ 1002 Grading
题目链接:http://ac.jobdu.com/problem.php?pid=1002 题目分析: 挺简单的,原文英文也挺好理解,太长了,我这里不翻译了=。= 源代码: #include #include #include #include using namespace std; int main() { int P, T, G1, G2, G3, GJ; doub原创 2013-05-15 20:01:46 · 995 阅读 · 0 评论 -
九度OJ 1010 A+B
题目链接:http://ac.jobdu.com/problem.php?pid=1010 题目分析: 先写一个函数将输入的数字单词转化为对应的数字,在计算值的时候调用该函数。 主要的算法在于对于输入字符串的逻辑判断,即:输入几个数字单词,什么时候打印值。 我的设计思想是:首先读入一个数字单词,然后读入下一个输入的字符串(中间判断空格在这里就不说了),判断先一个字符串是加号还是数字原创 2013-05-18 00:12:42 · 1324 阅读 · 0 评论 -
九度OJ 1052 找x
题目链接:http://ac.jobdu.com/problem.php?pid=1052 题目分析: 将输入数据存到数组中,设置一个标志位temp判断是否找到数据。 源代码: #include using namespace std; int main() { int n; while (cin>>n) { int a[210] = {0}; int x原创 2013-05-18 00:31:40 · 1289 阅读 · 0 评论 -
九度OJ 1046 求最大值
题目链接:http://ac.jobdu.com/problem.php?pid=1046 题目分析: 不分析了,太简单了=。= 注意一下输入的时候是多组吧。 源代码: #include using namespace std; int main() { int a[10] = {0}; while (cin>>a[0]) { for (int i =原创 2013-05-19 17:39:18 · 986 阅读 · 0 评论 -
九度OJ1064 反序数
题目链接:http://ac.jobdu.com/problem.php?pid=1064 题目分析: 求出一个数的反序数,与原数的9倍进行比较。 源代码: #include using namespace std; int main() { int a = 0; for (int i = 1000; i <= 1111; i ++) { a = (i % 1原创 2013-06-09 17:11:15 · 1041 阅读 · 0 评论 -
九度OJ1053 互换最大最小数
题目链接:http://ac.jobdu.com/problem.php?pid=1053 题目分析: 使用数组存储数据,找到最大最小数进行交换。 注意输出数据的格式,在每两个数之间有一个空格,但最后一个数后面没有空格! 源代码: #include using namespace std; int main() { int n = 0; while (cin>>n)原创 2013-06-10 20:52:46 · 1100 阅读 · 0 评论 -
九度OJ1057 众数
题目链接:http://ac.jobdu.com/problem.php?pid=1057 题目分析: 注意输入格式以及题目信息就好了,挺简单的。 源代码: #include #include using namespace std; int main() { while (1) { int num = 0; //众数 int a[11] = {0};原创 2013-06-09 16:53:21 · 1017 阅读 · 0 评论 -
九度OJ 1049 字符串去特定字符
题目链接:http://ac.jobdu.com/problem.php?pid=1049 题目分析: 输入字符串,再输入剔除的字符,用一个for循环,将字符串中的剔除字符剔除,打印输出。 源代码: #include #include using namespace std; int main() { string s; //字符串 while (cin>>s)原创 2013-05-17 18:17:47 · 1011 阅读 · 0 评论 -
九度OJ 1202 排序
题目链接:http://ac.jobdu.com/problem.php?pid=1202 题目分析: 简单的数字排序,注意输入输出格式就好。 源代码: #include #include using namespace std; int main() { int num; while (cin>>num) { int a[200] = {0}; int原创 2013-05-17 17:00:03 · 1028 阅读 · 0 评论 -
九度OJ 1001 A+B for Matrices
题目链接:http://ac.jobdu.com/problem.php?pid=1001 题目分析: 题目看起来要耐心,题目写的很难懂,看懂了之后会发现原来是一道非常简单的题目。 首先输入矩阵的行列数,然后输入矩阵的信息,这里要输入两个一样行列数的矩阵,然后将两个矩阵相加,分别计算相加之后的得到的新矩阵的每一行,每一列都为0的个数,然后得到为0个数的总和。 源代码: #include原创 2013-05-15 17:54:23 · 924 阅读 · 0 评论 -
九度OJ1098 字母统计
题目链接:http://ac.jobdu.com/problem.php?pid=1098 题目分析: 使用两个数组分别存储字母表和对应的字母出现次数。 源代码: #include #include using namespace std; int main() { char ch[30] = {'A','B','C','D','E','F','G','H','I','原创 2013-06-07 13:08:18 · 947 阅读 · 0 评论 -
九度OJ 1021 统计字符
题目链接:http://ac.jobdu.com/problem.php?pid=1021 题目分析: 注意空格也算作字符统计,使用getline函数接收字符串。 源代码: #include #include #include using namespace std; int main() { string c; while (getline(cin, c))原创 2013-05-19 14:33:22 · 813 阅读 · 0 评论 -
九度OJ 1006 ZOJ问题
题目链接:http://ac.jobdu.com/problem.php?pid=1006 题目分析: 要读懂题目里给的3条规则,找到会Accepted的规律。我找到的规律是: 1.首字母为z:那么不管中间有多少个o,只要最后只有1个j就结束的话,那么全部Accepted。 2.首字母不为z,则必须为o:根据后面两条规则,找到规律----只要a*b = c(这里b是z和j之间o的个原创 2013-05-19 12:52:10 · 1028 阅读 · 0 评论 -
九度OJ 1031 xxx定律
题目链接:http://ac.jobdu.com/problem.php?pid=1031 题目分析: 简单的递归算法,不解释了,直接看代码吧。 源代码: #include using namespace std; int n; //输入数字 int i = 0; //转化步数 void cut(int n) { if (n == 1) { cout<<i<<原创 2013-05-16 23:17:34 · 973 阅读 · 0 评论 -
九度OJ 1054 字符串内排序
题目链接:http://ac.jobdu.com/problem.php?pid=1054 题目分析: 简单的排序。设置字符串保存输入数据,然后排序。 源代码: #include #include using namespace std; int main() { string s; while (cin>>s) { if (s.length() > 200原创 2013-05-17 16:40:45 · 957 阅读 · 0 评论
分享