제출 #126985

#제출 시각아이디문제언어결과실행 시간메모리
126985LawlietSure Bet (CEOI17_sure)C++14
20 / 100
2 ms376 KiB
#include <bits/stdc++.h>

#define MAX 1010

using namespace std;

int n;

float ans;
float sumA, sumB;

float a[MAX];
float b[MAX];

int main()
{
	scanf("%d",&n);

	for(int g = 1 ; g <= n ; g++)
		scanf("%f %f",&a[g],&b[g]);

	sort(a + 1 , a + n + 1);
	sort(b + 1 , b + n + 1);

	for(int qtdA = 0 ; qtdA <= n ; qtdA++)
	{
		if(qtdA != 0) sumA += a[ n - qtdA + 1 ];
		sumB = 0.0;

		for(int qtdB = 0 ; qtdB <= n ; qtdB++)
		{
			if(qtdB != 0) sumB += b[ n - qtdB + 1 ];

			float fA = (float) qtdA;
			float fB = (float) qtdB;

			float aux;

			if(sumA > sumB) aux = sumB - fA - fB;
			else aux = sumA - fA - fB;

			ans = max(ans , aux);
		}
	}

	printf("%.4lf\n",(double) ans);
}

컴파일 시 표준 에러 (stderr) 메시지

sure.cpp: In function 'int main()':
sure.cpp:17:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n);
  ~~~~~^~~~~~~~~
sure.cpp:20:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%f %f",&a[g],&b[g]);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...