#include <bits/stdc++.h>
#define int long long
using namespace std;
int teklif_sayisi, fark, teklif1, teklif2, teklif3, buyuk_teklif, kucuk_teklif, total_teklif;
int32_t main()
{
cin >> teklif_sayisi >> fark;
for (int i = 0; i < teklif_sayisi; i++)
{
cin >> teklif1 >> teklif2;
if(teklif1 >= teklif2){
buyuk_teklif = teklif1;
kucuk_teklif = teklif2;
}
else{
buyuk_teklif = teklif2;
kucuk_teklif = teklif1;
}
if(buyuk_teklif - kucuk_teklif <= fark){
total_teklif += buyuk_teklif;
}
else{
cin >> teklif3;
total_teklif += teklif3;
}
}
cout << total_teklif << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
508 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |