Submission
Status:
PPPPPPPPPP
Score: 100
User: Him123
Problemset: เดินทางไกล
Language: cpp
Time: 0.002 second
Submitted On: 2025-03-16 11:58:49
#include <iostream>
using namespace std;
int main(){
int N;
int S;
cin >> N >> S;
int SumMin = 0, SumMax = 0;
for (int i = 0; i < N; i++) {
int height;
cin >> height;
if (height % 3 == 0 && height % 4 != 0) {
int dist = (10 * height)/3;
SumMin += dist;
SumMax += dist;
}
else if (height % 4 == 0 && height % 3 != 0) {
int dist = (10 * height)/4;
SumMin += dist;
SumMax += dist;
}
else if (height % 4 == 0 && height % 3 == 0) {
int distType1 = (10 * height)/3;
int distType2 = (10 * height)/4;
SumMax += distType1;
SumMin += distType2;
}
}
cout << (S - SumMax) << " " << (S - SumMin);
}