/*编程求两个矩阵相乘的结果.输入第一行是整数m,n,表示第一个矩阵式m行n列的:然后是一个m * n的矩阵.再下一行的输入时整数p,q,表示下一个矩阵p行,q列的(n=p);然后就是一个p行q列的矩阵.要求输出两个矩阵相乘的结果矩阵(1<m.n.p.q<=8).P82页2014年10月3日21:32:23*/#include <iostream>using namespace std;const int size = 10;void init(int *, int *, int
day30 --------------------------------------------------------------- 实例044:矩阵相加 题目 计算两个矩阵相加. 分析:矩阵可以看成是二维列表,外围列表指的就是矩阵的行,里面的列表就是对应的列,即a[1][2]代表第一行第二列. def Matrix(col,row): list = [] if col or row: for i in range(1,row+1): list2 = [] for j in range(1
题目描述: Find the largest palindrome made from the product of two n-digit numbers. Since the result could be very large, you should return the largest palindrome mod 1337. Example: Input: 2 Output: 987 Explanation: 99 x 91 = 9009, 9009 % 1337 = 987 Note
这道题的算法思想是把字符串1中的每个字符与字符串2中的每个字符进行比较,遇到共同拥有的字符,放入另一个数组中,最后顺序输出即可 但是这道题的难点在于怎么排除重复的字符 public class bothChar { public static String bothChar(String str1,String str2){ StringBuffer sb = new StringBuffer(); int n1,n2,m=0; //char a[]=new char[50]; n1=str1.