fork download
  1. #include <iostream>
  2. using namespace std;
  3. int ile_pol(int n) {
  4. return n * n;
  5. }
  6. int ile_kolorowych(int n, char kolor) {
  7. if (kolor == 'b')
  8. return n * n / 2;
  9. else
  10. return (n * n - 1) / 2 + 1;
  11. }
  12. int main() {
  13. cout << ile_pol(8) << endl;
  14. cout << ile_pol(13) << endl;
  15. cout << ile_kolorowych(8, 'b') << endl;
  16. cout << ile_kolorowych(7, 'c') << endl;
  17. return 0;
  18. }
Success #stdin #stdout 0s 4388KB
stdin
Standard input is empty
stdout
64
169
32
25