Loading...
Submission
Id When Author Problem Language CPU Memory Verdict
5496 2022-06-02 22:51:28 ewu_battle21u_08 Shift the liquid C++ 14 395 ms 3460 kb Wrong Answer - 3
Test Cases
CPU Memory Verdict
1 4 ms 3248 kb Accepted
2 3 ms 3396 kb Accepted
3 395 ms 3460 kb Wrong Answer
4 - - Skipped
5 - - Skipped
6 - - Skipped
7 - - Skipped
8 - - Skipped
9 - - Skipped
10 - - Skipped
11 - - Skipped
12 - - Skipped
13 - - Skipped
14 - - Skipped
15 - - Skipped
16 - - Skipped
17 - - Skipped
18 - - Skipped
19 - - Skipped
20 - - Skipped
21 - - Skipped
Source Code
program.cpp
Download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int n, m, p = 0;
  6. cin >> n >> m;
  7. if (n == 1)
  8. {
  9. cout << n / m << endl;
  10. }
  11. else
  12. {
  13. if (n % 4 == 0)
  14. {
  15. n = n / 4;
  16. for (int i = 1; i <= n; i++)
  17. {
  18. if ((m * i) == n)
  19. {
  20. p = i;
  21. }
  22. }
  23.  
  24. cout << p * 4 << endl;
  25. }
  26. else
  27. {
  28. n = n / 2;
  29. for (int i = 1; i <= n; i++)
  30. {
  31. if ((m * i) == n)
  32. {
  33. p = i;
  34. }
  35. }
  36.  
  37. cout << p * 2 << endl;
  38. }
  39. }
  40. }
  41.