Click on the link full solution summary PAT B -AC
topic:
Given N non-zero digit, with which any two numbers can be combined into a two-digit number. 2 requires that all possible combinations of numbers and out. 2,5,8 example given, it can be combined: 25,28,52,58,82,85, and 330 thereof.
Input formats:
on a single line is given to N (1 <N <10) , followed by analysis of the N different non-zero digit. Between numbers separated by a space.
Output Format:
Output all possible combinations of 2 digits and out.
Sample input:
3 2 8 5
Sample output:
330
My code:
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<set>
#include<map>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<cstring>
#include<sstream>
using namespace std;
//有的时候题目是一起做的,所以会有不需要的头文件
int main()
{
int N;
cin>>N;
int sum=0;
for(int i=0;i<N;i++)
{
int t;
cin>>t;
sum=sum + 11*t*(N-1);
}
cout<<sum;
return 0;
}