#include <QCoreApplication>
#include <bits/stdc++.h>
#include <iostream>
#include <stdio.h>
using namespace std;
int main(int argc, char *argv[])
{
QCoreApplication ap(argc, argv);
FILE *fp, *fout;
long long a, b, c, m;
fp = fopen ("0","r+");
fscanf (fp, "%lld\n%lld\n%lld", &a, &b, &c);
fclose(fp);
long long sum = 2 * a + 3 * b + 4 * c;
long long cnt = a + b + c;
long long l = 0, r = cnt + 1;
// Алгоритм бинарного поиска
while (l < r)
m = (l + r) / 2;
if ((sum + 5.0 * m) / (cnt + m) < 3.5)
l = m + 1;
else
r = m;
}
fout = fopen ("0.a","w+");
fprintf (fout,"%lld",l);
fclose(fout);
return
Объяснение:
#include <QCoreApplication>
#include <bits/stdc++.h>
#include <iostream>
#include <stdio.h>
using namespace std;
int main(int argc, char *argv[])
{
QCoreApplication ap(argc, argv);
FILE *fp, *fout;
long long a, b, c, m;
fp = fopen ("0","r+");
fscanf (fp, "%lld\n%lld\n%lld", &a, &b, &c);
fclose(fp);
long long sum = 2 * a + 3 * b + 4 * c;
long long cnt = a + b + c;
long long l = 0, r = cnt + 1;
// Алгоритм бинарного поиска
while (l < r)
{
m = (l + r) / 2;
if ((sum + 5.0 * m) / (cnt + m) < 3.5)
l = m + 1;
else
r = m;
}
fout = fopen ("0.a","w+");
fprintf (fout,"%lld",l);
fclose(fout);
return
Объяснение:
#include <QCoreApplication>
#include <bits/stdc++.h>
#include <iostream>
#include <stdio.h>
using namespace std;
int main(int argc, char *argv[])
{
QCoreApplication ap(argc, argv);
FILE *fp, *fout;
long long a, b, c, m;
fp = fopen ("0","r+");
fscanf (fp, "%lld\n%lld\n%lld", &a, &b, &c);
fclose(fp);
long long sum = 2 * a + 3 * b + 4 * c;
long long cnt = a + b + c;
long long l = 0, r = cnt + 1;
// Алгоритм бинарного поиска
while (l < r)
{
m = (l + r) / 2;
if ((sum + 5.0 * m) / (cnt + m) < 3.5)
l = m + 1;
else
r = m;
}
fout = fopen ("0.a","w+");
fprintf (fout,"%lld",l);
fclose(fout);
return
Объяснение: