UOJ Logo

NOI.AC

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#212526#3842. 小t做晚餐2(cook)Caohanxuan_111213300ms1216kbC++11826b2024-10-19 10:45:422024-10-19 12:33:57

answer

#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	int ans=0;
	int d[1005];
	for(int i=1;i<=a;i++){
		cin>>d[i];
	} 
	sort(d+1,d+a+1);
	for(int i=a;i>=1;i--){
		if(d[i]!=-1){
		long long sum=b-d[i];
		if(sum!=0){
			int zg=d[i];
			bool o=1;
			while(o!=0){
				sum=b-zg;
				long long minn=999999999;
				for(int j=a-1;j>=1;j--){
					if(d[j]!=-1){
						if(d[j]<=sum){
							long long num=sum-d[j];
							minn=min(minn,num);
						}
					}
				}
				if(minn==999999999){
					break;
				}
				for(int j=a-1;j>=1;j--){
					if(d[j]!=-1){
						if(d[j]<=sum){
							long long num=sum-d[j];
							if(num==minn){
								zg+=d[j];
								d[j]=-1;
							}
						}
					}
				}
				
			}
			
		}
		ans++;
	}
	}
	cout<<ans*c;
	return 0;
}

Details

小提示:点击横条可展开更详细的信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 1212kb

input:

5 14 9
10 7 7 7 3

output:

18

result:

wrong answer 1st lines differ - expected: '27', found: '18'

Test #2:

score: 10
Accepted
time: 0ms
memory: 1216kb

input:

8 14 4
7 10 1 7 8 6 10 12

output:

20

result:

ok single line: '20'

Test #3:

score: 10
Accepted
time: 0ms
memory: 1212kb

input:

8 20 3
14 17 6 6 9 12 15 18

output:

18

result:

ok single line: '18'

Test #4:

score: 10
Accepted
time: 0ms
memory: 1212kb

input:

10 30 4
6 16 16 9 23 20 9 3 1 8

output:

16

result:

ok single line: '16'

Test #5:

score: 0
Wrong Answer
time: 0ms
memory: 1216kb

input:

10 41 23
17 7 7 1 8 15 17 16 12 3

output:

92

result:

wrong answer 1st lines differ - expected: '69', found: '92'

Test #6:

score: 0
Wrong Answer
time: 0ms
memory: 1208kb

input:

20 95400260 89673557
20487698 22301259 2829304 297290 1412988 16842716 23469759 30225551 23431967 16...

output:

448367785

result:

wrong answer 1st lines differ - expected: '358694228', found: '448367785'

Test #7:

score: 0
Wrong Answer
time: 0ms
memory: 1212kb

input:

20 67248590 51724831
648120 20516501 13360885 3511712 27876258 27548361 19789779 14004233 13644809 8...

output:

310348986

result:

wrong answer 1st lines differ - expected: '206899324', found: '310348986'

Test #8:

score: 0
Wrong Answer
time: 0ms
memory: 1212kb

input:

20 32236123 23129506
9697610 3181601 12248516 13725824 1976763 3805852 10010680 13270519 12901003 78...

output:

208165554

result:

wrong answer 1st lines differ - expected: '138777036', found: '208165554'

Test #9:

score: 0
Wrong Answer
time: 0ms
memory: 1212kb

input:

20 50597385 71307217
20562436 23376499 14957779 2472920 13994843 22843456 16389516 13712272 24008015...

output:

641764953

result:

wrong answer 1st lines differ - expected: '427843302', found: '641764953'

Test #10:

score: 0
Wrong Answer
time: 0ms
memory: 1212kb

input:

20 79575244 7977295
21610095 13701521 24651488 4567616 15005155 6234858 15956463 15009333 5191205 59...

output:

63818360

result:

wrong answer 1st lines differ - expected: '47863770', found: '63818360'