fork download
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6. freopen("KHOASO.INP","r",stdin);
  7. freopen("KHOASO.OUT","w",stdout);
  8.  
  9. int a,b,c,d;
  10. cin >> a >> b >> c >> d;
  11.  
  12. a = (abs(a-2) > 5) ? (10 - abs(a-2)) : abs(a-2) ;
  13. b = (abs(b-0) > 5) ? (10 - abs(b-0)) : abs(b-0) ;
  14. c = (abs(c-2) > 5) ? (10 - abs(c-2)) : abs(c-2) ;
  15. d = (abs(d-5) > 5) ? (10 - abs(d-5)) : abs(d-5) ;
  16.  
  17. cout << a + b + c + d;
  18.  
  19. return 0;
  20. }
  21.  
Success #stdin #stdout 0s 5284KB
stdin
Standard input is empty
stdout
Standard output is empty