crackerwang说这次由我出题,鉴于各位大多没学过数据结构和算法,我就选了两道不需要算法和数据结构的题。大家可以在线测试一下自己的代码,再把代码发上来。
原题地址:
http://acm.fzu.edu.cn/problem.php?pid=1505
注册地址:
http://acm.fzu.edu.cn/reg.php
提交地址:
http://acm.fzu.edu.cn/submit.php?pid=1505
这题比较简单,不需要任何算法。大家踊跃尝试
Minimum value
时限:1秒 内存:32M
通过:50 提交:117
An arithmetic expression is defined as a sequence of positive integers, separated by arithmetic operators: +,-,(,). Given an arithmetic expression without parentheses, you are to calculate the minimum possible value for the expression, by adding appropriate parentheses to the expression.
Input
The input contains several test cases. Each test case is a single line containing a expression.
The expression consists of only positive integers,+,-
Numbers in expression may contain leading zeroes and is within 32bit integer, the total length of the expression will not exceed 100.
Output
For each case, output an integer representing the minimum value of the expression.
Sample input
00009-00009
10+20+30+40
1-4+6
Sample output
0
100
-9
题目大意,给定一个不含括号的加减表达式,你可以为它任意添加括号,输出这个表达式在添加括号后可能达到的最小值。
例如1-4+6 可以添加成为1-(4+6)=-9
第二题原题地址:
http://acm.pku.edu.cn/JudgeOnline/problem?id=3213
注册地址:
http://acm.pku.edu.cn/JudgeOnline/register
提交地址:
http://acm.pku.edu.cn/JudgeOnline/submit?problem_id=3213
这题也不需要算法,但需要一点关于矩阵运算的知识
PM3
Time Limit:5000MS Memory Limit:131072K
Total Submit:1532 Accepted:380
Description
USTC has recently developed the Parallel Matrix Multiplication Machine – PM3, which is used for very large matrix multiplication.
Given two matrices A and B, where A is an N × P matrix and B is a P × M matrix, PM3 can compute matrix C = AB in O(P(N + P + M)) time. However the developers of PM3 soon discovered a small problem: there is a small chance that PM3 makes a mistake, and whenever a mistake occurs, the resultant matrix C will contain exactly one incorrect element.
The developers come up with a natural remedy. After PM3 gives the matrix C, they check and correct it. They think it is a simple task, because there will be at most one incorrect element.
So you are to write a program to check and correct the result computed by PM3.
Input
The first line of the input three integers N, P and M (0 < N, P, M ≤ 1,000), which indicate the dimensions of A and B. Then follow N lines with P integers each, giving the elements of A in row-major order. After that the elements of B and C are given in the same manner.
Elements of A and B are bounded by 1,000 in absolute values which those of C are bounded by 2,000,000,000.
Output
If C contains no incorrect element, print “Yes”. Otherwise print “No” followed by two more lines, with two integers r and c on the first one, and another integer v on the second one, which indicates the element of C at row r, column c should be corrected to v.
Sample Input
2 3 2
1 2 -1
3 -1 0
-1 0
0 2
1 3
-2 -1
-3 -2
Sample Output
No
1 2
1
Hint
The test set contains large-size input. Iostream objects in C++ or Scanner in Java might lead to efficiency problems.
Source
POJ Monthly--2007.04.01, zhucheng
题目大意是,有一种新机器(PM3)被开发出来用于计算超大矩阵的乘法,但是存在一点小问题,PM3算出的结果矩阵可能存在一个元素是错的,并且至多一个元素是错的。请你检查并纠正PM3的计算结果。