fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int a , b, n;
  6. cin >> a >> b >> n;
  7. int copyN = n;
  8. while (copyN) {
  9. if ((a % 2 == 0 && b % 2 == 0 && n % 2 == 0) && copyN > 1) {
  10. //if (copyN == 1) {
  11. // cout << b << "<";
  12. //} else {
  13. cout << a;
  14. //}
  15. } else if ((a % 2 == 0 && b % 2 == 0 && n % 2 == 0) && copyN == 1){
  16. cout << b;
  17. }else if ((a % 2 != 0 || b % 2 != 0 || n % 2 != 0)) {
  18. cout << (a + n) / 3 ;
  19. }
  20. --copyN;
  21. }
  22. cout <<"\n>>" << (9+9+9+9+9+9+9+9+9) / 9 ;
  23. return 0;
  24. }
Success #stdin #stdout 0.01s 5320KB
stdin
7 2 9
stdout
555555555
>>9