// Online C++ compiler to run C++ program online
#include <iostream>
using namespace std;
int main() {
int x = 0;
int sayac = 0;
cin >> x;
int y = 0;
int s = 0;
cin >> y;
for(int i = 0;i < x;i++){
int z = 0;
int h = 0;
cin>>z;
cin>>h;
if(abs(h-z) <= y){
sayac+=max(h ,z);
}else{
cin >> s;
sayac+=s;
}
}
cout << sayac;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
372 KB |
Output is correct |
4 |
Correct |
1 ms |
336 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 |