1 solutions
-
0
C++ :
#include <bits/stdc++.h> using namespace std; int main() { int n; //freopen("F:\\QQDownlaod\\Laputa\\2015.3.23\\1(2)\\test.in","r",stdin); while(~scanf("%d",&n)){ long long d[405],b[405]; for (int i=0;i<n;i++) scanf("%lld",&d[i]); for (int i=0;i<n;i++) scanf("%lld",&b[i]); sort(d,d+n); sort(b,b+n); long long sum=0; for (int i=0;i<n;i++){ sum+=(d[i]*b[n-1-i]); } printf("%lld\n",sum); } return 0; }
- 1
Information
- ID
- 18275
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By