标签:
Time Limit: 300/100 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)
Total Submission(s): 2957 Accepted Submission(s): 1882
#include<iostream> #include<cstdio> #include<cstring> #include<cstdlib> #include<cmath> #include<string> #include<algorithm> using namespace std; int a[10010],tt,ans,n; int main() { scanf("%d",&tt); while(tt--) { ans=0; scanf("%d",&n); for(int i=1;i<=n;i++) scanf("%d",&a[i]); sort(a+1,a+1+n); int now=0; for(int i=1;i<=n;i++,ans++) { if(a[i]<=now) continue; ans+=6*(a[i]-now); ans+=5; now=a[i]; } ans+=now*4; printf("%d\n",ans); } return 0; }
标签:
原文地址:http://www.cnblogs.com/a972290869/p/4231089.html