http://acm.pku.edu.cn/JudgeOnline/problem?id=3673 原题
很简单题
- import java.io.*;
- import java.util.*;
- public class Main
- {
- static int[] num1;
- static int[] num2;
- public static void main(String[] args) throws Exception
- {
- readFile();
- process();
- }
- public static void readFile() throws Exception
- {
- BufferedReader br = new BufferedReader(
- new InputStreamReader(System.in));
- StringTokenizer st = new StringTokenizer(
- br.readLine()," ");
- String sTemp = st.nextToken();
- num1 = new int[sTemp.length()];
- for(int i=0; i<num1.length; i++)
- {
- num1[i] = Integer.valueOf(sTemp.charAt(i)-48);
- }
- sTemp = st.nextToken();
- num2 = new int[sTemp.length()];
- for(int i=0; i<num2.length; i++)
- {
- num2[i] = Integer.valueOf(sTemp.charAt(i)-48);
- }
- }
- public static void process()
- {
- long sum = 0L;
- for(int i=0; i<num1.length; i++)
- {
- for(int j=0; j<num2.length; j++)
- {
- sum += (num1[i]*num2[j]);
- }
- }
- System.out.print(sum);
- }
- }